mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-02 13:42:15 +02:00
htlcswitch: set forwarding information from encrypted data
If we received a payload with a encrypted data point set, our forwarding information should be set from the information in our encrypted blob. This behavior is the same for introduction and relying nodes in a blinded route.
This commit is contained in:
@@ -106,10 +106,27 @@ 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:
|
||||
payload, _, err := NewPayloadFromReader(
|
||||
isFinal := r.processedPacket.Action == sphinx.ExitNode
|
||||
payload, parsed, err := NewPayloadFromReader(
|
||||
bytes.NewReader(r.processedPacket.Payload.Payload),
|
||||
r.processedPacket.Action == sphinx.ExitNode,
|
||||
isFinal,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If we had an encrypted data payload present, pull out our
|
||||
// forwarding info from the blob.
|
||||
if payload.encryptedData != nil {
|
||||
fwdInfo, err := r.blindingKit.DecryptAndValidateFwdInfo(
|
||||
payload, isFinal, parsed,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
payload.FwdInfo = *fwdInfo
|
||||
}
|
||||
|
||||
return payload, err
|
||||
|
||||
|
Reference in New Issue
Block a user