From 9981a0a9f2cdd23a904f66f1649dc530facf6186 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 5 Dec 2023 05:24:32 +1030 Subject: [PATCH] BOLT 2: specify nSequence explicitly. 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 --- 02-peer-protocol.md | 4 ++++ 03-transactions.md | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/02-peer-protocol.md b/02-peer-protocol.md index f2b5c27..f3c4f76 100644 --- a/02-peer-protocol.md +++ b/02-peer-protocol.md @@ -1747,6 +1747,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` @@ -1779,6 +1780,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. @@ -1800,6 +1802,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`. diff --git a/03-transactions.md b/03-transactions.md index e7c3cef..2d2802d 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -396,7 +396,7 @@ 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. @@ -404,7 +404,7 @@ The side with lesser funds can opt to omit their own output. * 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 `