@@ -16,6 +16,7 @@ import (
1616 "github.com/lightningnetwork/lnd/lnwire"
1717 "github.com/lightningnetwork/lnd/record"
1818 "github.com/lightningnetwork/lnd/routing/route"
19+ "github.com/lightningnetwork/lnd/tlv"
1920 "github.com/stretchr/testify/require"
2021)
2122
@@ -149,20 +150,34 @@ func TestSentPaymentSerialization(t *testing.T) {
149150 require .NoError (t , err , "deserialize" )
150151 require .Equal (t , c , newCreationInfo )
151152
153+ b .Reset ()
152154 require .NoError (t , serializeHTLCAttemptInfo (& b , s ), "serialize" )
153155
154156 newWireInfo , err := deserializeHTLCAttemptInfo (& b )
155157 require .NoError (t , err , "deserialize" )
156- newWireInfo .AttemptID = s .AttemptID
157158
158- // First we verify all the records match up properly, as they aren't
159- // able to be properly compared using reflect.DeepEqual.
160- err = assertRouteEqual (& s .Route , & newWireInfo .Route )
161- require .NoError (t , err )
159+ // First we verify all the records match up properly.
160+ require .Equal (t , s .Route , newWireInfo .Route )
161+
162+ // We now add the new fields and custom records to the route and
163+ // serialize it again.
164+ b .Reset ()
165+ s .Route .FirstHopAmount = tlv.NewRecordT [tlv.TlvType0 ](
166+ tlv .NewBigSizeT (lnwire .MilliSatoshi (1234 )),
167+ )
168+ s .Route .FirstHopWireCustomRecords = lnwire.CustomRecords {
169+ lnwire .MinCustomRecordsTlvType + 3 : []byte {4 , 5 , 6 },
170+ }
171+ require .NoError (t , serializeHTLCAttemptInfo (& b , s ), "serialize" )
172+
173+ newWireInfo , err = deserializeHTLCAttemptInfo (& b )
174+ require .NoError (t , err , "deserialize" )
175+ require .Equal (t , s .Route , newWireInfo .Route )
162176
163177 // Clear routes to allow DeepEqual to compare the remaining fields.
164178 newWireInfo .Route = route.Route {}
165179 s .Route = route.Route {}
180+ newWireInfo .AttemptID = s .AttemptID
166181
167182 // Call session key method to set our cached session key so we can use
168183 // DeepEqual, and assert that our key equals the original key.
0 commit comments