mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 03:57:40 +02:00
htlcswitch/hop: explicitly signal final hop from sphinx packet
Previously, we were using nextChanID to determine whether a hop payload is for the final recipient. This is no longer suitable in a route-blinding world where intermediate hops are allowed to have zero nextChanID TLVs (as this information is provided to forwarding nodes in their encrypted data). This commit updates payload reading to use the signal provided by sphinx that we are on the last packet, rather than implying it from the contents of a hop.
This commit is contained in:
@@ -90,9 +90,10 @@ func (r *sphinxHopIterator) HopPayload() (*Payload, error) {
|
||||
// Otherwise, if this is the TLV payload, then we'll make a new stream
|
||||
// to decode only what we need to make routing decisions.
|
||||
case sphinx.PayloadTLV:
|
||||
return NewPayloadFromReader(bytes.NewReader(
|
||||
r.processedPacket.Payload.Payload,
|
||||
))
|
||||
return NewPayloadFromReader(
|
||||
bytes.NewReader(r.processedPacket.Payload.Payload),
|
||||
r.processedPacket.Action == sphinx.ExitNode,
|
||||
)
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown sphinx payload type: %v",
|
||||
|
Reference in New Issue
Block a user