mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-10 15:10:48 +02:00
htlcswitch: ensure onion related errors always have the BadOnion bit set
In this commit, we fix a lingering protocol level bug when reporting errors encountered during onion blob processing. The spec states that if one sends an UpdateFailMalformedHtlc, then the error reason MUST have the BadOnion bit set. Before this commit, we would return CodeTemporaryChannelFailure. This is incorrect as this doesn’t have the BadOnio bit set.
This commit is contained in:
@@ -170,7 +170,7 @@ func (p *OnionProcessor) DecodeHopIterator(r io.Reader, rHash []byte) (HopIterat
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
default:
|
||||
log.Errorf("unable to decode onion packet: %v", err)
|
||||
return nil, lnwire.CodeTemporaryChannelFailure
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ func (p *OnionProcessor) DecodeHopIterator(r io.Reader, rHash []byte) (HopIterat
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
default:
|
||||
log.Errorf("unable to process onion packet: %v", err)
|
||||
return nil, lnwire.CodeTemporaryChannelFailure
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ func (p *OnionProcessor) ExtractErrorEncrypter(r io.Reader) (ErrorEncrypter, lnw
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
default:
|
||||
log.Errorf("unable to decode onion packet: %v", err)
|
||||
return nil, lnwire.CodeTemporaryChannelFailure
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ func (p *OnionProcessor) ExtractErrorEncrypter(r io.Reader) (ErrorEncrypter, lnw
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
default:
|
||||
log.Errorf("unable to process onion packet: %v", err)
|
||||
return nil, lnwire.CodeTemporaryChannelFailure
|
||||
return nil, lnwire.CodeInvalidOnionKey
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user