-
Notifications
You must be signed in to change notification settings - Fork 407
Fix bug in Channel #669
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
Fix bug in Channel #669
Conversation
Before this commit, `fn get_inbound_outbound_available_balance_msat` always returns 0. It is because using `cmp::min` instead of `cmp::max` .
Codecov Report
@@ Coverage Diff @@
## master #669 +/- ##
==========================================
+ Coverage 91.35% 91.40% +0.05%
==========================================
Files 35 35
Lines 21688 21703 +15
==========================================
+ Hits 19813 19838 +25
+ Misses 1875 1865 -10
Continue to review full report at Codecov.
|
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. @valentinewallace can you take a look?
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.
Thanks @joemphilips!!
Pretty weird -- so afaict, this method was added in 3d55d71 to set the corresponding fields in ChannelDetails
, but the fields were/are never actually accessed anywhere, hence why no tests caught this. I'm guessing there was a follow-up plan to add them to more tests/fuzzing that didn't happen?
The ChannelDetails as a struct is used a bunch of times, e.g. in list_channels
and similar functions, but it's usually just to get the channel ID or to count the number of channels, rarely are other fields accessed.
ChannelDetails
's user_id
, channel_value_satoshis
also seem to be lightly tested or untested.
So, I guess as an alternative, these fields and method could be removed? @TheBlueMatt But I'm fine with merging as is
@valentinewallace for |
Oops, I didn't look at the full history of this, my bad! Indeed, these should get functional-level tests, I think, but doesn't have to happen here. |
Oh, well you crossed it out but that's a good point that those fields would be useful for users, heh. And, agreed |
Before this commit,
fn get_inbound_outbound_available_balance_msat
always returns 0.It is because using
cmp::min
instead ofcmp::max
.