Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
option_simple_close (features 60/61) #1096
option_simple_close (features 60/61) #1096
Changes from all commits
d299e0d
aa6deb8
62f6b5b
c22fd7b
4fa6f92
74f32dc
182c77b
5d3fa98
77baa9a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This doesn't seem like the typical use case where one side initiates the close and the other signs. Some explanation somewhere is needed:
closing_complete
override A's? And in that case, why does B sendclosing_sig
?closing_complete
at the same time, so we have 2 flows happening at once?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.
There is one flow happening in each direction, where the sender of
closing_complete
is paying the fee.Let me know if the proposed diagram here makes it easier to reason about.
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.
Do we really expect dual flows to happen like that in practice? If the other party offers to pay for the closing transaction, why would we want to send
closing_complete
at all?Your diagram helps to clarify corner cases but probably still needs some high-level explanation in the spec.
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.
I think we do, because each side should independently decide what fee they'd like to pay and immediately send
closing_complete
(at least that's how I implemented it). Since the channel has already stopped relaying HTLCs at that point, both peers are likely eager to get their funds back asap to reinvest them into another channel.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.
As of bitcoind 25, when submitted via the
sendrawtransaction
API (which I assume we all use), the value of anOP_RETURN
must be zero unless a new param is set: https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-25.0.md#updated-rpcsPerhaps we should also recommend that if an
OP_RETURN
is used as the closing addr, then the output of the sender should always be zero. Otherwise, this could prevent a variant of the co-op close transaction from propagating.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.
Circling back to this, we should just say:
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.
Done in 6e0db70
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.
What about also including
lockTime
like we do inopen_channel2
?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.
Done in 47afb0e
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.
I find it easy to confuse these types with the current naming.
Can we make the names more precise? Something like:
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.
Done in 8cfc619
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.
In what case wouldn't the signature fields be set?
Also why are three versions needed at all? If by the time we decide to co-op close, I'm the only one that has a non-dust output, then why would I ever send a signature with my output removed?
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.
Having trouble understanding the requirement above (local balance < remote balance): shouldn't this instead state that as along as the remote party has a non-dust output, then
closer_no_closee
should never be set?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.
Or is this just saying that they shouldn't burn the closee's settled output as fees to miners?
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.
Ah ok, reading further, this makes more sense: before we would sort of implicitly decide to remove outputs based on dust values (had some prior ambiguity there w.r.t which dust values were used), but now we make all the cases explicit!
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.
That is the gentleman's approach, but that isn't the most efficient one for the closee. If the closee receives a proposal that contains
no_closer_closee
, that is the option that pays the most fees, so the closee has an incentive to choose this one instead ofcloser_and_closee
?In practice though, if the sender sends
no_closer_closee
, they won't sendcloser_and_closee
, so those cases are only theoretical?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.
How can the sender even send
no_closer_closee
? IIUC, the side sending theclosing_complete
needs to pay for fees, so if they remove their output (it all goes to fees), then wouldn't they be better off just not sending the sig at all?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.
That's not what I would do: if I have a non-economical balance remaining in the channel, I would offer
no_closer_closee
so that my peer can potentially get their funds back without paying fees. This is a nice thing to do and doesn't cost me anything, since I wouldn't get those funds back on-chain anyway.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.
We could also mention RBF of the closing transaction here.
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.
Also I fail to understand how we could ever have a transaction be urgent enough to push for confirmation if it involved burning all of the outputs in an OP_RETURN.
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.
Done in 8cfc619
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.
so you can negotiate again (even changing the output address) if you want
doesn't this override the safety feature of upfront shutdown?
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.
This is of course if you don't have
upfront_shutdown
activated, we can make that clearer.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.
Done in 8cfc619
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.
This discussion of the game theory hints at an issue I've always had with the "opener pays" rule. I do understand the pathological scenario that the rule is meant to avoid (where a malicious node can drain the funds of a victim node by repeatedly opening and abandoning channels to it), but this new proposal creates a perverse incentive.
Olav opens a channel to Kristján. Some time later, Kristján wants the channel closed. Under this new proposal, Kristján's fee-optimal channel-closing strategy would be to transmit a bogus
error
message to Olav so that Olav will be forced (by protocol convention) to unilaterally close the channel. Thusly, Kristján would obtain an immediately spendable output and would avoid paying any fees.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.
That's always true.
But K can also mutual close at <1 sat per byte.
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.
How can any mutual closing transaction use <1 sat/vB fee rate? The transaction would not propagate.
And you're right that it's always true. It has always irked me. I swear I have seen some cases where nodes to which I have opened channels have sent me
error
messages for no reason other than to get me to unilaterally close. I think it was a design mistake to have commitment transactions reward the non-closing party with an immediately spendable output. I think commitment transactions should time-lock both outputs to discourage baiting a peer into unilaterally closing.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.
That will disappear once we have package relay, because at that point commitment transactions will pay no fees. The fees will have to be paid using CPFP on an ephemeral anchor. Also, if you send bogus
error
s, nodes will start blacklisting you at some point and won't accept new channels from you: this isn't the case today, but will definitely be in the future.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.
The opener should at least be on the hook for whatever the commitment fee is. Otherwise, as the non-opener, it's cheaper to FC and wait out the time lock. Also, if there's nothing on the non-opener side, is FC the only options since there's nothing on that side to pay the fee.
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.
I want to challenge this idea of "it's cheaper to FC and wait out the time lock". Having money locked up carries opportunity cost of the entire output. Yes you may save in fees, but your outputs are tied up in chain resolution and that is a cost in its own right.
Why would a node be concerned about aggressively closing a channel that has no capital tied up in it?
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.
Current coop close is ~168 vB (2 x
P2WPKH
outputs) to ~192 vB (2 xP2TR
outputs). Sweeping the timelock is 121-123 vB.. so ~35-50% smaller tx. I agree with the time cost, but if you are closing due to months of inactivity, what's another up to two weeks. But the opener would be doubly screwed since they would pay the FC (+ anchors) and then have to pay to sweep. I supposed the opener can "deter" this by keeping max commit fees low.Closing channels should be discouraged, but having dead/inactive channel is worse.
In my mind, game theory would have me coop close at a very low fee if the balance is mostly on the other side or FC if it's mostly on my side and I'm not the opener and commit fee is high enough.
More of a hypothetical.. how does a closer pay if there's little to nothing on their side.
I agree a change to channel closing is needed, but 100% opener to 100% closer is a pretty drastic change. I would like to see the opener using (some of) the commit fee already reserved and/or splitting the fee based on balance.