Skip to content

Commit

Permalink
BOLT 2: specify nSequence explicitly.
Browse files Browse the repository at this point in the history
We don't care, as long as it's RBF-able.  This will be nicer for
Taproot when mutual closes are otherwise indistinguishable from normal
spends.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Dec 4, 2023
1 parent 5d3fa98 commit 77baa9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions 02-peer-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ This process will be repeated every time a `shutdown` message is received, which
2. data:
* [`channel_id`:`channel_id`]
* [`u64`:`fee_satoshis`]
* [`u32`:`sequence`]
* [`closing_tlvs`:`tlvs`]

1. `tlv_stream`: `closing_tlvs`
Expand Down Expand Up @@ -842,6 +843,7 @@ Both nodes:
The sender of `closing_complete` (aka. "the closer"):
- MUST set `fee_satoshis` to a fee less than or equal to its outstanding balance, rounded down to whole satoshis.
- MUST set `fee_satoshis` so that at least one output is not dust.
- MUST set `sequence` to a value other than 0xFFFFFFFF.
- MUST use the last send and received `shutdown` `scriptpubkey` to generate the closing transaction specified in [BOLT #3](03-transactions.md#closing-transaction).
- If it sets `signature` fields, MUST set them as valid signature using its `funding_pubkey` of:
- `closer_no_closee`: closing transaction with only the local ("closer") output.
Expand All @@ -863,6 +865,8 @@ The sender of `closing_complete` (aka. "the closer"):
The receiver of `closing_complete` (aka. "the closee"):
- If `fee_satoshis` is greater than the closer's outstanding balance:
- MUST either send a `warning` and close the connection, or send an `error` and fail the channel.
- If `sequence` is equal to 0xFFFFFFFF:
- MUST either send a `warning` and close the connection, or send an `error` and fail the channel.
- Select a signature for validation:
- if the local output amount is dust:
- MUST use `closer_no_closee`.
Expand Down
4 changes: 2 additions & 2 deletions 03-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,15 @@ than twice `dust_limit_satoshis`.

This variant is used for `closing_complete` and `closing_sig` messages (i.e. where `option_simple_close` is negotiated).

In this case, the node sending `closing_complete` ("the closer") pays the fees, and the sequence is set to 0xFFFFFFFD to allow RBF. The outputs are ordered as detailed in [Transaction Output Ordering](#transaction-output-ordering).
In this case, the node sending `closing_complete` ("the closer") pays the fees, and the sequence specified to allow RBF. The outputs are ordered as detailed in [Transaction Output Ordering](#transaction-output-ordering).

The side with lesser funds can opt to omit their own output.

* version: 2
* locktime: 0
* txin count: 1
* `txin[0]` outpoint: `txid` and `output_index` from `funding_created` message
* `txin[0]` sequence: 0xFFFFFFFD
* `txin[0]` sequence: `sequence` from `closing_complete` message
* `txin[0]` script bytes: 0
* `txin[0]` witness: `0 <signature_for_pubkey1> <signature_for_pubkey2>`

Expand Down

0 comments on commit 77baa9a

Please sign in to comment.