multi: allow invalid tlv data when decoding payment fail info
Older payments might have a invalid tlv stream, we now catch this case and add a unit test.
This commit is contained in:
5 files changed
+139
-3
No files matched your search
+11
-1
@@ -2099,9 +2099,19 @@ func deserializeHTLCFailInfo(r io.Reader) (*HTLCFailInfo, error) {
|
||||
f.Message, err = lnwire.DecodeFailureMessage(
|
||||
bytes.NewReader(failureBytes), 0,
|
||||
)
|
||||
if err != nil {
|
||||
if err != nil &&
|
||||
!errors.Is(err, lnwire.ErrParsingExtraTLVBytes) {
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// In case we have an invalid TLV stream regarding the extra
|
||||
// tlv data we still continue with the decoding of the
|
||||
// HTLCFailInfo.
|
||||
if errors.Is(err, lnwire.ErrParsingExtraTLVBytes) {
|
||||
log.Warnf("Failed to decode extra TLV bytes for "+
|
||||
"failure message: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
var reason byte
|
||||
|
||||
Reference in new issue
Block a user