Skip to content

Commit 34e9cd9

Browse files
rustyrussellTheBlueMatt
authored andcommitted
Rename funding_locked to channel_ready.
And `next_per_commitment_point` to explictly `second_per_commitment_point`; this is particularly important since `channel_ready` can be retransmitted after the channel has been in use, for example. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 7a812cf commit 34e9cd9

File tree

3 files changed

+33
-34
lines changed

3 files changed

+33
-34
lines changed

02-peer-protocol.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ operation, and closing.
1212
* [The `accept_channel` Message](#the-accept_channel-message)
1313
* [The `funding_created` Message](#the-funding_created-message)
1414
* [The `funding_signed` Message](#the-funding_signed-message)
15-
* [The `funding_locked` Message](#the-funding_locked-message)
15+
* [The `channel_ready` Message](#the-channel_ready-message)
1616
* [Channel Close](#channel-close)
1717
* [Closing Initiation: `shutdown`](#closing-initiation-shutdown)
1818
* [Closing Negotiation: `closing_signed`](#closing-negotiation-closing_signed)
@@ -70,8 +70,8 @@ must broadcast the funding transaction to the Bitcoin network. After
7070
the `funding_signed` message is sent/received, both sides should wait
7171
for the funding transaction to enter the blockchain and reach the
7272
specified depth (number of confirmations). After both sides have sent
73-
the `funding_locked` message, the channel is established and can begin
74-
normal operation. The `funding_locked` message includes information
73+
the `channel_ready` message, the channel is established and can begin
74+
normal operation. The `channel_ready` message includes information
7575
that will be used to construct channel authentication proofs.
7676

7777

@@ -82,8 +82,8 @@ that will be used to construct channel authentication proofs.
8282
| A |--(3)-- funding_created --->| B |
8383
| |<-(4)-- funding_signed -----| |
8484
| | | |
85-
| |--(5)--- funding_locked ---->| |
86-
| |<-(6)--- funding_locked -----| |
85+
| |--(5)--- channel_ready ---->| |
86+
| |<-(6)--- channel_ready -----| |
8787
+-------+ +-------+
8888

8989
- where node A is 'funder' and node B is 'fundee'
@@ -471,21 +471,20 @@ use `option_static_remotekey`, `option_anchor_outputs` or
471471
`option_static_remotekey`, and the superior one is favored if more than one
472472
is negotiated.
473473

474-
### The `funding_locked` Message
474+
### The `channel_ready` Message
475475

476-
This message indicates that the funding transaction has reached the `minimum_depth` asked for in `accept_channel`. Once both nodes have sent this, the channel enters normal operating mode.
476+
This message (which used to be called `funding_locked`) indicates that the funding transaction has sufficient confirms for channel use. Once both nodes have sent this, the channel enters normal operating mode.
477477

478-
Note that `minimum_depth` can be 0 if the accepter trusts the opener,
479-
in which case this message is a misnomer. The opener is free to send this
480-
message at any time (since it presumably trusts itself).
478+
Note that the opener is free to send this message at any time (since it presumably trusts itself), but the
479+
accepter would usually wait until the funding has reached the `minimum_depth` asked for in `accept_channel`.
481480

482-
1. type: 36 (`funding_locked`)
481+
1. type: 36 (`channel_ready`)
483482
2. data:
484483
* [`channel_id`:`channel_id`]
485-
* [`point`:`next_per_commitment_point`]
486-
* [`funding_locked_tlvs`:`tlvs`]
484+
* [`point`:`second_per_commitment_point`]
485+
* [`channel_ready_tlvs`:`tlvs`]
487486

488-
1. `tlv_stream`: `funding_locked_tlvs`
487+
1. `tlv_stream`: `channel_ready_tlvs`
489488
2. types:
490489
1. type: 1 (`short_channel_id`)
491490
2. data:
@@ -494,12 +493,12 @@ message at any time (since it presumably trusts itself).
494493
#### Requirements
495494

496495
The sender:
497-
- MUST NOT send `funding_locked` unless outpoint of given by `funding_txid` and
496+
- MUST NOT send `channel_ready` unless outpoint of given by `funding_txid` and
498497
`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).
499498
- if it is not the node opening the channel:
500499
- SHOULD wait until the funding transaction has reached `minimum_depth` before
501500
sending this message.
502-
- MUST set `next_per_commitment_point` to the per-commitment point to be used
501+
- MUST set `second_per_commitment_point` to the per-commitment point to be used
503502
for commitment transaction #1, derived as specified in
504503
[BOLT #3](03-transactions.md#per-commitment-secret-requirements).
505504
- if `option_scid_alias` was negotiated:
@@ -516,7 +515,7 @@ The sender:
516515
- MUST always recognize the `alias` as a `short_channel_id` for incoming HTLCs to this channel.
517516
- if `channel_type` has `option_scid_alias` set:
518517
- MUST NOT allow incoming HTLCs to this channel using the real `short_channel_id`
519-
- MAY send multiple `funding_locked` messages to the same peer with different `alias` values.
518+
- MAY send multiple `channel_ready` messages to the same peer with different `alias` values.
520519
- otherwise:
521520
- MUST wait until the funding transaction has reached `minimum_depth` before sending this message.
522521

@@ -532,7 +531,7 @@ The receiver:
532531
- if `channel_type` has `option_scid_alias` set:
533532
- MUST NOT use the real `short_channel_id` in BOLT 11 `r` fields.
534533

535-
From the point of waiting for `funding_locked` onward, either node MAY
534+
From the point of waiting for `channel_ready` onward, either node MAY
536535
send an `error` and fail the channel if it does not receive a required response from the
537536
other node after a reasonable timeout.
538537

@@ -598,7 +597,7 @@ along with the `scriptpubkey` it wants to be paid to.
598597
A sending node:
599598
- if it hasn't sent a `funding_created` (if it is a funder) or a `funding_signed` (if it is a fundee):
600599
- MUST NOT send a `shutdown`
601-
- MAY send a `shutdown` before a `funding_locked`, i.e. before the funding transaction has reached `minimum_depth`.
600+
- MAY send a `shutdown` before a `channel_ready`, i.e. before the funding transaction has reached `minimum_depth`.
602601
- if there are updates pending on the receiving node's commitment transaction:
603602
- MUST NOT send a `shutdown`.
604603
- MUST NOT send an `update_add_htlc` after a `shutdown`.
@@ -620,7 +619,7 @@ A receiving node:
620619
- SHOULD send an `error` and fail the channel.
621620
- if the `scriptpubkey` is not in one of the above forms:
622621
- SHOULD send a `warning`.
623-
- if it hasn't sent a `funding_locked` yet:
622+
- if it hasn't sent a `channel_ready` yet:
624623
- MAY reply to a `shutdown` message with a `shutdown`
625624
- once there are no outstanding updates on the peer, UNLESS it has already sent a `shutdown`:
626625
- MUST reply to a `shutdown` message with a `shutdown`
@@ -770,7 +769,7 @@ the closing transaction will likely never reach miners.
770769

771770
## Normal Operation
772771

773-
Once both nodes have exchanged `funding_locked` (and optionally [`announcement_signatures`](07-routing-gossip.md#the-announcement_signatures-message)), the channel can be used to make payments via Hashed Time Locked Contracts.
772+
Once both nodes have exchanged `channel_ready` (and optionally [`announcement_signatures`](07-routing-gossip.md#the-announcement_signatures-message)), the channel can be used to make payments via Hashed Time Locked Contracts.
774773

775774
Changes are sent in batches: one or more `update_` messages are sent before a
776775
`commitment_signed` message, as in the following diagram:
@@ -1424,12 +1423,12 @@ The sending node:
14241423
A node:
14251424
- if `next_commitment_number` is 1 in both the `channel_reestablish` it
14261425
sent and received:
1427-
- MUST retransmit `funding_locked`.
1426+
- MUST retransmit `channel_ready`.
14281427
- otherwise:
1429-
- MUST NOT retransmit `funding_locked`, but MAY send `funding_locked` with
1428+
- MUST NOT retransmit `channel_ready`, but MAY send `channel_ready` with
14301429
a different `short_channel_id` `alias` field.
14311430
- upon reconnection:
1432-
- MUST ignore any redundant `funding_locked` it receives.
1431+
- MUST ignore any redundant `channel_ready` it receives.
14331432
- if `next_commitment_number` is equal to the commitment number of
14341433
the last `commitment_signed` message the receiving node has sent:
14351434
- MUST reuse the same commitment number for its next `commitment_signed`.
@@ -1497,7 +1496,7 @@ atomic: if it doesn't complete, it starts again. The only exception
14971496
is if the `funding_signed` message is sent but not received. In
14981497
this case, the funder will forget the channel, and presumably open
14991498
a new one upon reconnection; meanwhile, the other node will eventually forget
1500-
the original channel, due to never receiving `funding_locked` or seeing
1499+
the original channel, due to never receiving `channel_ready` or seeing
15011500
the funding transaction on-chain.
15021501

15031502
There's no acknowledgment for `error`, so if a reconnect occurs it's
@@ -1533,7 +1532,7 @@ commitment number 0 is created during opening.
15331532
`commitment_signed` for commitment number 1 is send and then
15341533
the revocation for commitment number 0 is received.
15351534

1536-
`funding_locked` is implicitly acknowledged by the start of normal
1535+
`channel_ready` is implicitly acknowledged by the start of normal
15371536
operation, which is known to have begun after a `commitment_signed` has been
15381537
received — hence, the test for a `next_commitment_number` greater
15391538
than 1.

07-routing-gossip.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The `announcement_signatures` message is created by constructing a `channel_anno
8585
A node:
8686
- if the `open_channel` message has the `announce_channel` bit set AND a `shutdown` message has not been sent:
8787
- MUST send the `announcement_signatures` message.
88-
- MUST NOT send `announcement_signatures` messages until `funding_locked`
88+
- MUST NOT send `announcement_signatures` messages until `channel_ready`
8989
has been sent and received AND the funding transaction has at least six confirmations.
9090
- otherwise:
9191
- MUST NOT send the `announcement_signatures` message.
@@ -104,8 +104,8 @@ A recipient node:
104104
`error` and fail the channel.
105105
- if it has sent AND received a valid `announcement_signatures` message:
106106
- SHOULD queue the `channel_announcement` message for its peers.
107-
- if it has not sent funding_locked:
108-
- MAY defer handling the announcement_signatures until after it has sent funding_locked
107+
- if it has not sent `channel_ready`:
108+
- MAY defer handling the announcement_signatures until after it has sent `channel_ready`
109109
- otherwise:
110110
- MUST ignore it.
111111

@@ -167,7 +167,7 @@ The origin node:
167167
- for the _Bitcoin blockchain_:
168168
- MUST set `chain_hash` value (encoded in hex) equal to `6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000`.
169169
- MUST set `short_channel_id` to refer to the confirmed funding transaction,
170-
as specified in [BOLT #2](02-peer-protocol.md#the-funding_locked-message).
170+
as specified in [BOLT #2](02-peer-protocol.md#the-channel_ready-message).
171171
- Note: the corresponding output MUST be a P2WSH, as described in [BOLT #3](03-transactions.md#funding-transaction-output).
172172
- MUST set `node_id_1` and `node_id_2` to the public keys of the two nodes
173173
operating the channel, such that `node_id_1` is the lexicographically-lesser of the
@@ -445,7 +445,7 @@ or `node_id_2` otherwise.
445445
### Requirements
446446

447447
The origin node:
448-
- MUST NOT send a created `channel_update` before `funding_locked` has been received.
448+
- MUST NOT send a created `channel_update` before `channel_ready` has been received.
449449
- MAY create a `channel_update` to communicate the channel parameters to the
450450
channel peer, even though the channel has not yet been announced (i.e. the
451451
`announce_channel` bit was not set).

09-features.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ The Context column decodes as follows:
4242
| 22/23 | `option_anchors_zero_fee_htlc_tx` | Anchor commitment type with zero fee HTLC transactions | IN | `option_static_remotekey` | [BOLT #3][bolt03-htlc-tx], [lightning-dev][ml-sighash-single-harmful]|
4343
| 26/27 | `option_shutdown_anysegwit` | Future segwit versions allowed in `shutdown` | IN | | [BOLT #2][bolt02-shutdown] |
4444
| 44/45 | `option_channel_type` | Node supports the `channel_type` field in open/accept | IN | | [BOLT #2](02-peer-protocol.md#the-open_channel-message) |
45-
| 46/47 | `option_scid_alias` | Supply channel aliases for routing | IN | | [BOLT #2][bolt02-funding-locked] |
45+
| 46/47 | `option_scid_alias` | Supply channel aliases for routing | IN | | [BOLT #2][bolt02-channel-ready] |
4646
| 48/49 | `option_payment_metadata` | Payment metadata in tlv record | 9 | | [BOLT #11](11-payment-encoding.md#tagged-fields)
47-
| 50/51 | `option_zeroconf` | Understands zeroconf channel types | IN | `option_scid_alias` | [BOLT #2][bolt02-funding-locked] |
47+
| 50/51 | `option_zeroconf` | Understands zeroconf channel types | IN | `option_scid_alias` | [BOLT #2][bolt02-channel-ready] |
4848

4949
## Definitions
5050

@@ -92,7 +92,7 @@ This work is licensed under a [Creative Commons Attribution 4.0 International Li
9292
[bolt02-open]: 02-peer-protocol.md#the-open_channel-message
9393
[bolt03-htlc-tx]: 03-transactions.md#htlc-timeout-and-htlc-success-transactions
9494
[bolt02-shutdown]: 02-peer-protocol.md#closing-initiation-shutdown
95-
[bolt02-funding-locked]: 02-peer-protocol.md#the-funding_locked-message
95+
[bolt02-channel-ready]: 02-peer-protocol.md#the-channel_ready-message
9696
[bolt04]: 04-onion-routing.md
9797
[bolt07-sync]: 07-routing-gossip.md#initial-sync
9898
[bolt07-query]: 07-routing-gossip.md#query-messages

0 commit comments

Comments
 (0)