From 38ae8cddb4b6ace3468c4bd0594d9d215dc4fec2 Mon Sep 17 00:00:00 2001 From: t-bast Date: Fri, 11 Oct 2024 09:45:40 +0200 Subject: [PATCH] Allow setting `nLockTime`, not `nSequence` We always set `nSequence` to `0xFFFFFFFD`, but each node can choose the `nLockTime` they want to use for the transactions for which they are paying the fees. --- 02-peer-protocol.md | 5 +---- 03-transactions.md | 9 +++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/02-peer-protocol.md b/02-peer-protocol.md index 8951c4b..65a5e9b 100644 --- a/02-peer-protocol.md +++ b/02-peer-protocol.md @@ -1750,7 +1750,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`] + * [`u32`:`locktime`] * [`closing_tlvs`:`tlvs`] 1. `tlv_stream`: `closing_tlvs` @@ -1783,7 +1783,6 @@ 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. @@ -1805,8 +1804,6 @@ 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 c4692b2..6dcc3bd 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -396,15 +396,16 @@ 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 specified 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. +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 +* locktime: `locktime` from the `closing_complete` message * txin count: 1 - * `txin[0]` outpoint: `txid` and `output_index` from `funding_created` message - * `txin[0]` sequence: `sequence` from `closing_complete` message + * `txin[0]` outpoint: `txid` and `output_index` of the channel output + * `txin[0]` sequence: 0xFFFFFFFD * `txin[0]` script bytes: 0 * `txin[0]` witness: `0 ` * txout count: 1 or 2