Skip to content
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

Add test coverage for failure of inconsistent MPP parts #1451

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

@TheBlueMatt TheBlueMatt commented Apr 26, 2022

When we receive multiple HTLCs which claim to be a part of the same
MPP but which are inconsistent for some reason, we should fail the
inconsistent HTLCs but keep the first HTLCs up until the first
inconsistency.

This works, but it turns out there was no test coverage, so we add
some here.

Discovered when CI didn't fail even though I noted #1447 (comment)

Based on #1435 because it makes testing MPP routes a ton easier.

@codecov-commenter
Copy link

codecov-commenter commented Apr 26, 2022

Codecov Report

Merging #1451 (958fa92) into main (d1b984d) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head 958fa92 differs from pull request most recent head acdd2dc. Consider uploading reports for the commit acdd2dc to get more accurate results

@@            Coverage Diff             @@
##             main    #1451      +/-   ##
==========================================
+ Coverage   90.88%   90.92%   +0.03%     
==========================================
  Files          75       75              
  Lines       41474    41663     +189     
  Branches    41474    41663     +189     
==========================================
+ Hits        37695    37881     +186     
- Misses       3779     3782       +3     
Impacted Files Coverage Δ
lightning/src/ln/channel.rs 88.42% <100.00%> (+0.01%) ⬆️
lightning/src/ln/channelmanager.rs 84.74% <100.00%> (+<0.01%) ⬆️
lightning/src/ln/functional_test_utils.rs 95.52% <100.00%> (-0.04%) ⬇️
lightning/src/ln/functional_tests.rs 97.18% <100.00%> (+0.03%) ⬆️
lightning/src/routing/router.rs 92.59% <100.00%> (ø)
lightning/src/util/events.rs 33.56% <100.00%> (ø)
lightning-background-processor/src/lib.rs 95.86% <0.00%> (+0.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1b984d...acdd2dc. Read the comment docs.

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

LGTM, I need only to check in deep the last commit (958fa92)


let failure_events = nodes[0].node.get_and_clear_pending_events();
assert_eq!(failure_events.len(), 2);
if let Event::PaymentPathFailed { .. } = failure_events[0] {} else { panic!(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

it appears to me here that with the second fail we're actually not panicking. Is the boolean a misnomer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea, its a bit confusing its really "test that the second fail doesnt panic". I force-pushed a rename to test_for_second_fail_panic to make it clearer.

arik-so
arik-so previously approved these changes Apr 27, 2022
arik-so
arik-so previously approved these changes Apr 27, 2022
When we receive multiple HTLCs which claim to be a part of the same
MPP but which are inconsistent for some reason, we should fail the
inconsistent HTLCs but keep the first HTLCs up until the first
inconsistency.

This works, but it turns out there was no test coverage, so we add
some here.
@TheBlueMatt
Copy link
Collaborator Author

Rebased after merge of #1435

Copy link
Contributor

@arik-so arik-so left a comment

Choose a reason for hiding this comment

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

still lgtm

@TheBlueMatt TheBlueMatt merged commit 9bdce47 into lightningdevkit:main Apr 29, 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.

None yet

5 participants