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

BOLT 2: closing tx fee clarifications #194

Merged
merged 2 commits into from
Jul 11, 2017

Conversation

rustyrussell
Copy link
Collaborator

@rustyrussell rustyrussell commented Jun 28, 2017

  1. You can't eliminate an output and also guarantee a certain fee, so
    we need to define exactly how to do this.

    Since the output is (presumably) dust, we might as well just discard it
    (effectively increasing the fee). This avoids the peer directly benefiting
    from the elimination as well.

  2. There are two final commitment transactions, which can be different if each side has a different
    dust level. Make it clear that the max fee must be less or equal to the base fee, not the actual
    (post-output-elimination) fee. This means it could be marginally higher than the final fee in theory,
    but in practice it's a tiny effect at worst.

You can't eliminate an output and also guarantee a certain fee, so
we need to define exactly how to do this.

Since the output is (presumably) dust, we might as well just discard it
(effectively increasing the fee).  This avoids the peer directly benefiting
from the elimination as well.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell requested a review from pm47 June 28, 2017 02:22
@pm47 pm47 self-assigned this Jun 28, 2017
…l fee.

The actual fee of the final tx may include eliminated outputs, which can
differ between one side and the other (since they have different thresholds).

Simplify this corner case by using our base fee calculation as the upper bound;
it should be close enough we don't care, but disagreement here could cause
negotiation breakdown.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell changed the title BOLT 2: make it clear that we set fee, *then* eliminate outputs. BOLT 2: closing tx fee clarifications Jun 30, 2017
paying `fee_satoshis`, without populating any output which is below
its own `dust_limit_satoshis`. The sender MAY also eliminate its own
paying `fee_satoshis`, then removing any output which is below
its own `dust_limit_satoshis`. The sender MAY then also eliminate its own
Copy link
Collaborator

@pm47 pm47 Jul 3, 2017

Choose a reason for hiding this comment

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

My brain hurts... 😣

Doesn't this invalidate the second either clause of the following paragraph?

Copy link
Contributor

Choose a reason for hiding this comment

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

To me this reads as "create signature for transaction before removing output" ... "then remove the output".

Wouldn't it be better to add something similar to your comment, @rustyrussell: "we calculate fee then remove outputs, not remove outputs then calculate fee." That is much less ambiguous :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed that this paragraph is pretty confusing. Here's a slightly re-worked version that I think we'll all find mouc more explicit:

The sender MUST set signature to the Bitcoin signature of the channel
closure transaction. The set fee_satoshi fee should be subtracted from
the output of the node that was responsible for paying the bitcoin fees
during the lifetime of the channel. When calculating the amount of
satoshis to subtract from the fee payer's output the absolute fee should
be calculated first, then any trimmed outputs removed. Each trimmed output
should contribute to (reduce the) the fee value explicitly subtracted from
the fee payer's output. The sender MAY also eliminate its own output
from the mutual close transaction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Roasbeef Hmm, that's backwards from what I meant. Trimming dust doesn't change inputs, so yeah, it effectively ups the fee paid. This is the same logic we use for commit txs.

But as agreed, will merge, and then the move to BOLT 3, and re-open another PR for clarification if we still need it...

@rustyrussell
Copy link
Collaborator Author

rustyrussell commented Jul 4, 2017 via email

@pm47
Copy link
Collaborator

pm47 commented Jul 5, 2017

As I understand it, we are now explicitely saying that the signature sent should have outputs above the remote's dust_limit_satoshis. Hence when the receiver wants to verify it, it only has to check against its own dust_limit_satoshis right?

I agree that this should be done in BOLT 3

@rustyrussell rustyrussell merged commit b574c18 into lightning:master Jul 11, 2017
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