channeldb: properly compare payment attempts in serialization test

This commit is contained in:
Olaoluwa Osuntokun 2019-08-23 12:50:25 -07:00
parent 64c7a0faa8
commit 441b15055b
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

@ -205,6 +205,17 @@ func TestSentPaymentSerialization(t *testing.T) {
t.Fatalf("unable to deserialize info: %v", err)
}
// First we verify all the records match up porperly, as they aren't
// able to be properly compared using reflect.DeepEqual.
assertRouteHopRecordsEqual(&s.Route, &newAttemptInfo.Route)
// With the hop recrods, equal, we'll now blank them out as
// reflect.DeepEqual can't properly compare tlv.Record instances.
newAttemptInfo.Route.Hops[0].TLVRecords = nil
newAttemptInfo.Route.Hops[1].TLVRecords = nil
s.Route.Hops[0].TLVRecords = nil
s.Route.Hops[1].TLVRecords = nil
if !reflect.DeepEqual(s, newAttemptInfo) {
s.SessionKey.Curve = nil
newAttemptInfo.SessionKey.Curve = nil