@@ -161,7 +161,6 @@ func newRoute(sourceVertex route.Vertex,
161161 fee int64
162162 totalAmtMsatBlinded lnwire.MilliSatoshi
163163 outgoingTimeLock uint32
164- tlvPayload bool
165164 customRecords record.CustomSet
166165 mpp * record.MPP
167166 metadata []byte
@@ -180,13 +179,6 @@ func newRoute(sourceVertex route.Vertex,
180179 return edge .ToNodeFeatures .HasFeature (feature )
181180 }
182181
183- // We start by assuming the node doesn't support TLV. We'll now
184- // inspect the node's feature vector to see if we can promote
185- // the hop. We assume already that the feature vector's
186- // transitive dependencies have already been validated by path
187- // finding or some other means.
188- tlvPayload = supports (lnwire .TLVOnionPayloadOptional )
189-
190182 if i == len (pathEdges )- 1 {
191183 // If this is the last hop, then the hop payload will
192184 // contain the exact amount. In BOLT #4: Onion Routing
@@ -204,12 +196,7 @@ func newRoute(sourceVertex route.Vertex,
204196 totalTimeLock += uint32 (finalHop .cltvDelta )
205197 outgoingTimeLock = totalTimeLock
206198
207- // Attach any custom records to the final hop if the
208- // receiver supports TLV.
209- if ! tlvPayload && finalHop .records != nil {
210- return nil , errors .New ("cannot attach " +
211- "custom records" )
212- }
199+ // Attach any custom records to the final hop.
213200 customRecords = finalHop .records
214201
215202 // If we're attaching a payment addr but the receiver
@@ -275,7 +262,6 @@ func newRoute(sourceVertex route.Vertex,
275262 ChannelID : edge .ChannelID ,
276263 AmtToForward : amtToForward ,
277264 OutgoingTimeLock : outgoingTimeLock ,
278- LegacyPayload : ! tlvPayload ,
279265 CustomRecords : customRecords ,
280266 MPP : mpp ,
281267 Metadata : metadata ,
@@ -659,8 +645,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
659645
660646 // The payload size of the final hop differ from intermediate hops
661647 // and depends on whether the destination is blinded or not.
662- lastHopPayloadSize := lastHopPayloadSize (r , finalHtlcExpiry , amt ,
663- ! features .HasFeature (lnwire .TLVOnionPayloadOptional ))
648+ lastHopPayloadSize := lastHopPayloadSize (r , finalHtlcExpiry , amt )
664649
665650 // We can't always assume that the end destination is publicly
666651 // advertised to the network so we'll manually include the target node.
@@ -882,14 +867,10 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
882867 return
883868 }
884869
885- supportsTlv := fromFeatures .HasFeature (
886- lnwire .TLVOnionPayloadOptional ,
887- )
888-
889870 payloadSize = edge .hopPayloadSizeFn (
890871 amountToSend ,
891872 uint32 (toNodeDist .incomingCltv ),
892- ! supportsTlv , edge .policy .ChannelID ,
873+ edge .policy .ChannelID ,
893874 )
894875 }
895876
@@ -1176,7 +1157,7 @@ func getProbabilityBasedDist(weight int64, probability float64,
11761157// It depends on the tlv types which are present and also whether the hop is
11771158// part of a blinded route or not.
11781159func lastHopPayloadSize (r * RestrictParams , finalHtlcExpiry int32 ,
1179- amount lnwire.MilliSatoshi , legacy bool ) uint64 {
1160+ amount lnwire.MilliSatoshi ) uint64 {
11801161
11811162 if r .BlindedPayment != nil {
11821163 blindedPath := r .BlindedPayment .BlindedPath .BlindedHops
@@ -1186,7 +1167,6 @@ func lastHopPayloadSize(r *RestrictParams, finalHtlcExpiry int32,
11861167 finalHop := route.Hop {
11871168 AmtToForward : amount ,
11881169 OutgoingTimeLock : uint32 (finalHtlcExpiry ),
1189- LegacyPayload : false ,
11901170 EncryptedData : encryptedData ,
11911171 }
11921172 if len (blindedPath ) == 1 {
@@ -1214,7 +1194,6 @@ func lastHopPayloadSize(r *RestrictParams, finalHtlcExpiry int32,
12141194 AmtToForward : amount ,
12151195 OutgoingTimeLock : uint32 (finalHtlcExpiry ),
12161196 CustomRecords : r .DestCustomRecords ,
1217- LegacyPayload : legacy ,
12181197 MPP : mpp ,
12191198 AMP : amp ,
12201199 Metadata : r .Metadata ,
0 commit comments