Skip to content

Commit 341ec84

Browse files
Crypt-iQniftynei
authored andcommitted
BOLT#02: clarify coop close requirements
This commit ensures closing_signed can only begin if there are no dangling commitments. It also clarifies update_fee requirements if it is sent after shutdown.
1 parent 074a71f commit 341ec84

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

02-peer-protocol.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,9 @@ A sending node:
605605
- MUST NOT send a `shutdown`.
606606
- MUST NOT send multiple `shutdown` messages.
607607
- MUST NOT send an `update_add_htlc` after a `shutdown`.
608-
- if no HTLCs remain in either commitment transaction:
609-
- MUST NOT send any `update` message after a `shutdown`.
608+
- if no HTLCs remain in either commitment transaction (including dust HTLCs)
609+
and neither side has a pending `revoke_and_ack` to send:
610+
- MUST NOT send any `update` message after that point.
610611
- SHOULD fail to route any HTLC added after it has sent `shutdown`.
611612
- if it sent a non-zero-length `shutdown_scriptpubkey` in `open_channel` or `accept_channel`:
612613
- MUST send the same value in `scriptpubkey`.
@@ -638,10 +639,13 @@ shutdown starts, the question of how to behave if it wasn't is avoided:
638639
the sender always sends a `commitment_signed` first.
639640

640641
As shutdown implies a desire to terminate, it implies that no new
641-
HTLCs will be added or accepted. Once any HTLCs are cleared, the peer
642-
may immediately begin closing negotiation, so we ban further updates
643-
to the commitment transaction (in particular, `update_fee` would be
644-
possible otherwise).
642+
HTLCs will be added or accepted. Once any HTLCs are cleared, there are no commitments
643+
for which a revocation is owed, and all updates are included on both commitment
644+
transactions, the peer may immediately begin closing negotiation, so we ban further
645+
updates to the commitment transaction (in particular, `update_fee` would be
646+
possible otherwise). However, while there are HTLCs on the commitment transaction,
647+
the initiator may find it desirable to increase the feerate as there may be pending
648+
HTLCs on the commitment which could timeout.
645649

646650
The `scriptpubkey` forms include only standard segwit forms accepted by
647651
the Bitcoin network, which ensures the resulting transaction will
@@ -660,8 +664,9 @@ The `shutdown` response requirement implies that the node sends `commitment_sign
660664

661665
### Closing Negotiation: `closing_signed`
662666

663-
Once shutdown is complete and the channel is empty of HTLCs, the final
664-
current commitment transactions will have no HTLCs, and closing fee
667+
Once shutdown is complete, the channel is empty of HTLCs, there are no commitments
668+
for which a revocation is owed, and all updates are included on both commitments,
669+
the final current commitment transactions will have no HTLCs, and closing fee
665670
negotiation begins. The funder chooses a fee it thinks is fair, and
666671
signs the closing transaction with the `scriptpubkey` fields from the
667672
`shutdown` messages (along with its chosen fee) and sends the signature;

0 commit comments

Comments
 (0)