Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

17e6c37 added the HTLCHandlingFailed event, including serialization thereof, however failed to add corresponding deserialization. This corrects that oversight by adding said deserialization.

Thanks to @wpaulino for catching the oversight.

@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2022

Codecov Report

Merging #1700 (ba0793f) into main (8c6cb99) will increase coverage by 0.27%.
The diff coverage is 0.00%.

❗ Current head ba0793f differs from pull request most recent head 089ccbb. Consider uploading reports for the commit 089ccbb to get more accurate results

@@            Coverage Diff             @@
##             main    #1700      +/-   ##
==========================================
+ Coverage   90.90%   91.17%   +0.27%     
==========================================
  Files          86       86              
  Lines       46304    48276    +1972     
  Branches    46304    48276    +1972     
==========================================
+ Hits        42091    44014    +1923     
- Misses       4213     4262      +49     
Impacted Files Coverage Δ
lightning/src/util/events.rs 38.62% <0.00%> (-0.88%) ⬇️
lightning/src/ln/functional_tests.rs 96.94% <0.00%> (-0.17%) ⬇️
lightning/src/ln/payment_tests.rs 98.83% <0.00%> (-0.06%) ⬇️
lightning/src/ln/priv_short_conf_tests.rs 97.23% <0.00%> (+0.63%) ⬆️
lightning/src/ln/channelmanager.rs 86.05% <0.00%> (+1.04%) ⬆️
lightning/src/ln/functional_test_utils.rs 95.74% <0.00%> (+2.14%) ⬆️
lightning/src/chain/channelmonitor.rs 93.35% <0.00%> (+2.18%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

jurvis
jurvis previously approved these changes Sep 7, 2022
Copy link
Contributor

@jurvis jurvis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops -- sorry 😓

@TheBlueMatt
Copy link
Collaborator Author

Should have been caught in review.

let mut failed_next_destination_opt = None;
read_tlv_fields!(reader, {
(0, prev_channel_id, required),
(2, failed_next_destination_opt, ignorable),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we read it as an Option when it's marked required when writing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's because HTLCDestination::NextHopChannel may fail to deserialize when serialized with a version prior to 0.0.110? And instead of handing the error up the chain and quitting deserialization altogether, we just don't read this event? If that's the case, a comment explaining this would indeed be appreciated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two reasons - (a) we can't construct a "dummy" HTLCDestination, which we have to do before we call read_tlv_fields so we construct an Option and check it after and (b) what @tnull said - its ignorable (ie deserialized with MaybeReadable) not optional in the read macro nomenclature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's because HTLCDestination::NextHopChannel may fail to deserialize when serialized with a version prior to 0.0.110? And instead of handing the error up the chain and quitting deserialization altogether, we just don't read this event?

Prior to 0.0.110 wouldn't we just ignore the event all together based on the odd type (25)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errr, sorry, the opposite of that - we may fail to read an HTLCDestination (its MaybeReadable) if a future version of LDK writes a new variant that we don't understand.

tnull
tnull previously approved these changes Sep 7, 2022
Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, mod the comment above.

let mut failed_next_destination_opt = None;
read_tlv_fields!(reader, {
(0, prev_channel_id, required),
(2, failed_next_destination_opt, ignorable),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's because HTLCDestination::NextHopChannel may fail to deserialize when serialized with a version prior to 0.0.110? And instead of handing the error up the chain and quitting deserialization altogether, we just don't read this event? If that's the case, a comment explaining this would indeed be appreciated.

@TheBlueMatt TheBlueMatt dismissed stale reviews from tnull and jurvis via ba0793f September 7, 2022 17:48
Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after squash.

17e6c37 added the
`HTLCHandlingFailed` event, including serialization thereof,
however failed to add corresponding deserialization. This corrects
that oversight by adding said deserialization.

Thanks to @wpaulino for catching the oversight.
@TheBlueMatt TheBlueMatt force-pushed the 2022-09-missing-event-deser branch from ba0793f to 089ccbb Compare September 7, 2022 21:57
@TheBlueMatt
Copy link
Collaborator Author

Squashed without further changes.

@TheBlueMatt TheBlueMatt merged commit a59b9d8 into lightningdevkit:main Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants