Skip to content

Fix channel reserve calculation on the sending side #998

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

Conversation

TheBlueMatt
Copy link
Collaborator

As the variable name implies holder_selected_chan_reserve_msat is
intended to be in millisatoshis, but is instead calculated in
satoshis.

We fix that error here and update the relevant tests to more
accurately calculate the expected reserve value and test both
success and failure cases.

Bug discovered by chanmon_consistency fuzz target.

As the variable name implies holder_selected_chan_reserve_msat is
intended to be in millisatoshis, but is instead calculated in
satoshis.

We fix that error here and update the relevant tests to more
accurately calculate the expected reserve value and test both
success and failure cases.

Bug discovered by chanmon_consistency fuzz target.
@TheBlueMatt TheBlueMatt added this to the 0.0.100 milestone Jul 13, 2021
@codecov
Copy link

codecov bot commented Jul 13, 2021

Codecov Report

Merging #998 (306e9a5) into main (afae12e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #998   +/-   ##
=======================================
  Coverage   90.78%   90.78%           
=======================================
  Files          60       60           
  Lines       30914    30929   +15     
=======================================
+ Hits        28064    28079   +15     
  Misses       2850     2850           
Impacted Files Coverage Δ
lightning/src/ln/channel.rs 88.66% <100.00%> (ø)
lightning/src/ln/functional_tests.rs 97.41% <100.00%> (+<0.01%) ⬆️

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 afae12e...306e9a5. Read the comment docs.

Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

Nice catch!

@TheBlueMatt
Copy link
Collaborator Author

Nice catch!

Thank the gods of honggfuzz.

Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

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

ACK 306e9a5

I've played a bit with the modified tests and checked other invocations of get_holder_selected_channel_reserve_satoshis()

@TheBlueMatt TheBlueMatt merged commit d37b1dd into lightningdevkit:main Jul 26, 2021
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.

3 participants