-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Don't fail on invalid extra tlv data when decoding a payment #10334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't fail on invalid extra tlv data when decoding a payment #10334
Conversation
4d5ac7f to
32a4bef
Compare
guggero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK, LGTM 🎉
Thanks a lot for the quick fix!
starius
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🏆
Please add a regression test (draft sent privately).
801f34c to
7e028dc
Compare
|
unit test added ! |
7e028dc to
e74fa5b
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a change to gracefully handle invalid TLV data when decoding payments, which can occur with older payments. This is achieved by wrapping TLV parsing errors in lnwire.ChannelUpdate1.Decode and then specifically checking for this error type in payments/db/kv_store.go:deserializeHTLCFailInfo. Instead of failing, it now logs a warning and continues, making the system more robust to legacy data formats. The changes are well-tested with a new unit test that constructs a corrupted TLV stream to verify the new behavior. The logic is sound and the implementation is correct. I have one suggestion to improve the readability of the error handling logic.
yyforyongyu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing about the %w: %w usage, otherwise good to go!
Older payments might have a invalid tlv stream, we now catch this case and add a unit test.
e74fa5b to
870d603
Compare
|
@guggero I wonder how often this happened in case of your node, maybe we do some have some older version which produces wrong InboundFee tlv values which we need to investigate. |
I only seem to have a single payment with such a failure. So I don't think any further investigation is necessary, seems to have been a fluke. |
Older payments might have a invalid tlv stream, we now catch this
case.