Skip to content

Conversation

@TheBlueMatt
Copy link
Collaborator

Based on #314, this fixes a bug found by chanmon_fail_consistency (and another bug that was introduced in the first fix). See comments/commits for more info.

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.

utACK, take some time to get channel_reserve_in_flight_removes, but I think it's right

// channel reserve is to ensure we can punish *them* if they misbehave, so we ignore any
// outbound HTLCs which will not be present in the next commitment transaction we send
// them (at least for fulfilled ones, failed ones won't modify value_to_self).
// Note that we will send HTLCs which we'd think violate the reserve value if we do not do
Copy link

Choose a reason for hiding this comment

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

*accept HTLCs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a bit confusingly worded, I'll rephrase it to "Note that we will send HTLCs which another instance of rust-lightning would think violate the reserve value..."

Copy link

Choose a reason for hiding this comment

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

Speaking of rust-lightning instance means this point isn't cleary specified in specs right ? Maybe think to open an issue on this.

// something if we punish them for broadcasting an old state).
if htlc_inbound_value_msat + msg.amount_msat + self.value_to_self_msat > (self.channel_value_satoshis - Channel::get_our_channel_reserve_satoshis(self.channel_value_satoshis)) * 1000 {
// Note that we don't really care about our commitment transactions, as the purpose of the
// channel reserve is to ensure we can punish *them* if they misbehave, so we ignore any
Copy link

Choose a reason for hiding this comment

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

*discount any outbound HTLCs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure.

// the reserve_satoshis we told them to always have as direct payment so that they lose
// something if we punish them for broadcasting an old state).
if htlc_inbound_value_msat + msg.amount_msat + self.value_to_self_msat > (self.channel_value_satoshis - Channel::get_our_channel_reserve_satoshis(self.channel_value_satoshis)) * 1000 {
// Note that we don't really care about our commitment transactions, as the purpose of the
Copy link

Choose a reason for hiding this comment

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

Okay, by "we don't really care about our commitment transactions" , you mean we can't rely on htlc outputs in commitment tx because what matters there is their fulfilled or not state ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, I'll rephrase, but what I really meant is that we dont care about lack of to_remote output in our local commitment txn as we werent gonna use it to punish them anyway.

Copy link

Choose a reason for hiding this comment

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

Ah better!

let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1);

let b_chan_values = get_channel_value_stat!(nodes[1], chan_1.2);
// Route the first two HTLCs. Note that the test is to check that, when you consider the values
Copy link

Choose a reason for hiding this comment

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

Well IMO this note is simply explaining the test better than the long description above, maybe it should be in top-level comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@TheBlueMatt TheBlueMatt force-pushed the 2019-03-removed-reserve-check branch from 1915540 to 054530c Compare March 22, 2019 21:44
@TheBlueMatt
Copy link
Collaborator Author

Can you confirm the new comments are clearer-enough?

@TheBlueMatt
Copy link
Collaborator Author

TheBlueMatt commented Mar 23, 2019 via email

@ariard
Copy link

ariard commented Mar 23, 2019

Good, read again every litigious comment, get them better

@TheBlueMatt TheBlueMatt merged commit 8b4cb9f into lightningdevkit:master Mar 25, 2019
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.

2 participants