Skip to content

Make test_duplicate_payment_hash_one_failure_one_success robust #1984

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

Merged
merged 1 commit into from
Jan 26, 2023

Conversation

TheBlueMatt
Copy link
Collaborator

test_duplicate_payment_hash_one_failure_one_success currently fails if the "wrong" HTLC is picked to be claimed. Given the HTLCs are identical, there's no way to figure out which we should claim. The test instead relies on a magic value - the first one is the right one....unless we change our CSPRNG implementation. When we try to do so, the test randomly fails.

Here we change one HTLC to a lower amount so we can figure out which transaction to broadcast to make the test robust against CSPRNG changes.

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.

One nit, otherwise LGTM.

CI failure seems unrelated.

@wpaulino
Copy link
Contributor

LGTM after squash

@codecov-commenter
Copy link

codecov-commenter commented Jan 26, 2023

Codecov Report

Base: 90.79% // Head: 91.06% // Increases project coverage by +0.27% 🎉

Coverage data is based on head (f4bb7c9) compared to base (8bb6614).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head f4bb7c9 differs from pull request most recent head 7dcbf2c. Consider uploading reports for the commit 7dcbf2c to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1984      +/-   ##
==========================================
+ Coverage   90.79%   91.06%   +0.27%     
==========================================
  Files          98       99       +1     
  Lines       51673    55379    +3706     
  Branches    51673    55379    +3706     
==========================================
+ Hits        46915    50431    +3516     
- Misses       4758     4948     +190     
Impacted Files Coverage Δ
lightning/src/ln/functional_tests.rs 97.07% <100.00%> (+0.13%) ⬆️
lightning/src/util/events.rs 28.73% <0.00%> (-1.78%) ⬇️
lightning/src/util/indexed_map.rs 96.29% <0.00%> (ø)
lightning/src/ln/onion_route_tests.rs 98.03% <0.00%> (+0.40%) ⬆️
lightning/src/chain/onchaintx.rs 95.39% <0.00%> (+1.04%) ⬆️
lightning/src/routing/router.rs 92.38% <0.00%> (+1.47%) ⬆️
lightning/src/routing/gossip.rs 94.06% <0.00%> (+1.91%) ⬆️
lightning/src/ln/channelmanager.rs 90.76% <0.00%> (+3.55%) ⬆️

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

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

`test_duplicate_payment_hash_one_failure_one_success` currently
fails if the "wrong" HTLC is picked to be claimed. Given the HTLCs
are identical, there's no way to figure out which we should claim.
The test instead relies on a magic value - the first one is the
right one....unless we change our CSPRNG implementation. When we
try to do so, the test randomly fails.

Here we change one HTLC to a lower amount so we can figure out
which transaction to broadcast to make the test robust against
CSPRNG changes.
@TheBlueMatt
Copy link
Collaborator Author

Squashed.

@TheBlueMatt TheBlueMatt merged commit 8bc3428 into lightningdevkit:main Jan 26, 2023
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.

4 participants