Skip to content

Commit ba00bf8

Browse files
authored
Add 2016 blocks channel funding timeout (#839)
Routing nodes have an incentive to use low fees when opening channels to ensure their activity is economically viable. However, when a funding transaction takes too long to confirm, the fundee may have forgotten the channel. In that case the funder is forced to broadcast the first commit tx to get his funds back and then open a new channel, which is costly. We can avoid this issue by simply knowing how long the fundee will wait, and ensuring the funding tx confirms before that period ends. We set this timeout to 2016 blocks (2 weeks).
1 parent 946bbeb commit ba00bf8

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

02-peer-protocol.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ The sender MUST set:
351351
The sender:
352352
- when creating the funding transaction:
353353
- SHOULD use only BIP141 (Segregated Witness) inputs.
354+
- SHOULD ensure the funding transaction confirms in the next 2016 blocks.
354355

355356
The recipient:
356357
- if `signature` is incorrect OR non-compliant with LOW-S-standard rule<sup>[LOWS](https://github.com/bitcoin/bitcoin/pull/6769)</sup>:
@@ -362,6 +363,9 @@ The `funding_output_index` can only be 2 bytes, since that's how it's packed int
362363

363364
A transaction with all Segregated Witness inputs is not malleable, hence the funding transaction recommendation.
364365

366+
The funder may use CPFP on a change output to ensure that the funding transaction confirms before 2016 blocks,
367+
otherwise the fundee may forget that channel.
368+
365369
### The `funding_signed` Message
366370

367371
This message gives the funder the signature it needs for the first
@@ -415,16 +419,15 @@ This message indicates that the funding transaction has reached the `minimum_dep
415419
The sender MUST:
416420
- NOT send `funding_locked` unless outpoint of given by `funding_txid` and
417421
`funding_output_index` in the `funding_created` message pays exactly `funding_satoshis` to the scriptpubkey specified in [BOLT #3](03-transactions.md#funding-transaction-output).
418-
- wait until the funding transaction has reached
419-
`minimum_depth` before sending this message.
420-
- set `next_per_commitment_point` to the
421-
per-commitment point to be used for the following commitment
422-
transaction, derived as specified in
423-
[BOLT #3](03-transactions.md#per-commitment-secret-requirements).
422+
- wait until the funding transaction has reached `minimum_depth` before
423+
sending this message.
424+
- set `next_per_commitment_point` to the per-commitment point to be used
425+
for the following commitment transaction, derived as specified in
426+
[BOLT #3](03-transactions.md#per-commitment-secret-requirements).
424427

425428
A non-funding node (fundee):
426-
- SHOULD forget the channel if it does not see the correct
427-
funding transaction after a reasonable timeout.
429+
- SHOULD forget the channel if it does not see the correct funding
430+
transaction after a timeout of 2016 blocks.
428431

429432
From the point of waiting for `funding_locked` onward, either node MAY
430433
fail the channel if it does not receive a required response from the
@@ -437,6 +440,11 @@ funds are at risk. If the fundee were to remember the channel forever, this
437440
would create a Denial of Service risk; therefore, forgetting it is recommended
438441
(even if the promise of `push_msat` is significant).
439442

443+
If the fundee forgets the channel before it was confirmed, the funder will need
444+
to broadcast the commitment transaction to get his funds back and open a new
445+
channel. To avoid this, the funder should ensure the funding transaction
446+
confirms in the next 2016 blocks.
447+
440448
## Channel Close
441449

442450
Nodes can negotiate a mutual close of the connection, which unlike a

0 commit comments

Comments
 (0)