mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-18 19:41:21 +02:00
htlcswitch/hop: use InvalidOnionVersion for replayed packets (#7937)
* htlcswitch/hop: use InvalidOnionVersion for replayed packets The link will send an update_fail_malformed_htlc, so we need to set the BADONION bit. Since there isn't a replay-specific error, we set the failure code to InvalidOnionVersion which has the BADONION bit. * release-notes: update for 0.17.1
This commit is contained in:
@@ -364,7 +364,14 @@ func (p *OnionProcessor) DecodeHopIterators(id []byte,
|
||||
if replays.Contains(uint16(i)) {
|
||||
log.Errorf("unable to process onion packet: %v",
|
||||
sphinx.ErrReplayedPacket)
|
||||
resp.FailCode = lnwire.CodeTemporaryChannelFailure
|
||||
|
||||
// We set FailCode to CodeInvalidOnionVersion even
|
||||
// though the ephemeral key isn't the problem. We need
|
||||
// to set the BADONION bit since we're sending back a
|
||||
// malformed packet, but as there isn't a specific
|
||||
// failure code for replays, we reuse one of the
|
||||
// failure codes that has BADONION.
|
||||
resp.FailCode = lnwire.CodeInvalidOnionVersion
|
||||
continue
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user