Skip to content

Commit 481c125

Browse files
committed
fixup! bolt-taproot-gossip
1 parent cfb2147 commit 481c125

File tree

1 file changed

+42
-46
lines changed

1 file changed

+42
-46
lines changed

bolt-taproot-gossip.md

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -254,16 +254,14 @@ While the network is in the upgrade phase, the following suggestions apply:
254254
255255
The following convenient types are defined:
256256
257-
* `bip340_sig`: a 64-byte bitcoin Elliptic Curve Schnorr signature as
257+
* `bip340sig`: a 64-byte bitcoin Elliptic Curve Schnorr signature as
258258
per [BIP-340][bip-340].
259259
* `partial_signature`: a 32-byte partial MuSig2 signature as defined
260260
in [BIP-MuSig2][bip-musig2].
261261
* `public_nonce`: a 66-byte public nonce as defined in [BIP-MuSig2][bip-musig2].
262262
* `utf8`: a byte as part of a UTF-8 string. A writer MUST ensure an array of
263263
these is a valid UTF-8 string, a reader MAY reject any messages containing an
264264
array of these which is not a valid UTF-8 string.
265-
* `boolean_tlv`: a zero length TLV record. If the TLV is present then true is
266-
implied, otherwise false is implied.
267265
268266
### Feature Bits
269267
@@ -350,7 +348,7 @@ The recipient:
350348
- SHOULD ignore the message.
351349
- Otherwise:
352350
- MUST store the nonces so that they can be used for the partial signature
353-
construction required for constructing the `announcement_signatures`
351+
construction required for constructing the `announcement_signatures_2`
354352
message.
355353
- If it has not yet done so, SHOULD respond with its own `channel_ready`
356354
message with the nonce fields set.
@@ -390,7 +388,7 @@ A node:
390388
- MUST set the `partial_signature` field to the 32-byte `partial_sig` value
391389
of the partial signature calculated as described in [Partial Signature
392390
Calculation](#partial-signature-calculation). The message to be signed is
393-
`MsgHash("channel_announcement", "announcement_sig", m)` where `m` is the
391+
`MsgHash("channel_announcement", "signature", m)` where `m` is the
394392
serialisation of the `channel_announcement_2` message tlv stream (see the
395393
[`MsgHash`](#signature-message-construction) definition).
396394
- otherwise:
@@ -442,7 +440,7 @@ channel.
442440
443441
1. type: 267 (`channel_announcement_2`)
444442
2. data:
445-
* [`bip340_sig`:`announcement_signature`]
443+
* [`bip340sig`:`signature`]
446444
* [`channel_announcement_2_tlvs`:`tlvs`]
447445
448446
1. `tlv_stream`: `channel_announcement_2_tlvs`
@@ -494,9 +492,9 @@ Unlike the legacy `node_announcement` message, this message makes use of a
494492
BIP340 signature instead of an ECDSA one. This will allow nodes to be backed
495493
by multiple keys since MuSig2 can be used to construct the single signature.
496494
497-
1. type 269
495+
1. type: 269 (`node_announcement_2`)
498496
2. data:
499-
* [`bip340_sig`:`announcement_sig`]
497+
* [`bip340sig`:`signature`]
500498
* [`node_announcement_2_tlvs`:`tlvs`]
501499
502500
1. `tlv_stream`: `node_announcement_2_tlvs`
@@ -560,8 +558,8 @@ The following subtypes are defined:
560558
561559
#### Message Field Descriptions
562560
563-
- `bip340_sig` is the [BIP340][bip-340] signature for the `node_id` key. The
564-
message to be signed is `MsgHash("node_announcement_2", "bip340_sig", m)`
561+
- `signature` is the [BIP340][bip-340] signature for the `node_id` key. The
562+
message to be signed is `MsgHash("node_announcement_2", "signature", m)`
565563
where `m` is the serialised TLV stream (see the
566564
[`MsgHash`](#signature-message-construction) definition).
567565
- `features` is a bit vector with bits set according to [BOLT #9](09-features.md#assigned-features-flags)
@@ -594,11 +592,11 @@ ok to send both? if so - what if the info inside them differs?
594592
The sender:
595593
596594
- MUST set TLV fields 0, 2 and 4.
597-
- MUST set `announcement_sig` to a valid [BIP340][bip-340] signature for the
595+
- MUST set `signature` to a valid [BIP340][bip-340] signature for the
598596
`node_id` key. The message to be signed is
599-
`MsgHash("node_announcement_2", "announcement_sig", m)` where `m` is the
597+
`MsgHash("node_announcement_2", "signature", m)` where `m` is the
600598
serialisation of the `node_announcement_2` message excluding the
601-
`announcement_sig` field (see the
599+
`signature` field (see the
602600
[`MsgHash`](#signature-message-construction) definition).
603601
- MAY set `color` and `alias` to customise appearance in maps and graphs.
604602
- If the node sets the `alias`:
@@ -635,7 +633,7 @@ The receiver:
635633
- SHOULD send a `warning`.
636634
- MAY close the connection.
637635
- MUST NOT process the message further.
638-
- if `announcement_sig` is NOT a valid [BIP340][bip-340] signature (using
636+
- if `signature` is NOT a valid [BIP340][bip-340] signature (using
639637
`node_id` over the message):
640638
- SHOULD send a `warning`.
641639
- MAY close the connection.
@@ -692,9 +690,9 @@ value for `amount_msat` and the minimal value for `cltv_expiry`, to be used for
692690
the last HTLC in the route, are provided in the payment request
693691
694692
(see [BOLT #11][[bolt-11-tagged-fields]]).
695-
1. type 271
693+
1. type: 271 (`channel_update_2`)
696694
2. data:
697-
* [`bip340_sig`:`bip340_sig`]
695+
* [`bip340sig`:`signature`]
698696
* [`channel_update_2_tlvs`:`tlvs`]
699697
700698
1. `tlv_stream`: `channel_update_2_tlvs`
@@ -711,9 +709,7 @@ the last HTLC in the route, are provided in the payment request
711709
1. type: 6 (`disable_flags`)
712710
2. data:
713711
* [`byte`:`disable_flags`]
714-
1. type: 8 (`direction`)
715-
2. data:
716-
* [`boolean_tlv`:`direction`]
712+
1. type: 8 (`second_peer`)
717713
1. type: 10 (`cltv_expiry_delta`)
718714
2. data:
719715
* [`u16`:`cltv_expiry_delta`]
@@ -731,17 +727,21 @@ the last HTLC in the route, are provided in the payment request
731727
* [`u32`:`fee_proportional_millionths`]
732728
733729
734-
The `disable_flags` bitfield is used to indicate that the channel is temporarily
735-
disabled. The following table specifies the meaning of the individual bits:
730+
The `disable_flags` bitfield is used to indicate that the channel is either
731+
temporarily or permanently disabled. The following table specifies the meaning
732+
of the individual bits:
736733
737-
| Bit Position | Name | Meaning |
738-
|---------------|------------|-------------------------------------------------|
739-
| 0 | `incoming` | The node can't receive via this channel |
740-
| 1 | `outgoing` | The node can't forward or send via this channel |
734+
| Bit Position | Name | Meaning |
735+
|--------------|-------------|-------------------------------------------------------|
736+
| 0 | `permanant` | The disable update is permanent (otherwise temporary) |
737+
| 1 | `incoming` | The node can't receive via this channel |
738+
| 2 | `outgoing` | The node can't forward or send via this channel |
741739
742740
Both the `incoming` and `outgoing` bit can be set to indicate that the channel
743741
peer is offline.
744742
743+
If the `permanant` bit is set, then the channel can be considered closed.
744+
745745
#### Message Field Descriptions
746746
747747
- The `chain_hash` is used to identify the blockchain containing the channel
@@ -757,11 +757,10 @@ peer is offline.
757757
- The `disable` bit field can be used to advertise to the network that a channel
758758
is disabled and that it should not be used for routing. The individual
759759
`disable_flags` bits can be used to communicate more fine-grained information.
760-
- The `direction` is used to indicate which node in the channel node pair
761-
has created and signed this message. If the node was `node_id_1` in the
762-
`channel_announcment` message then the `direction` is 0 (false) otherwise
763-
it is 1 (true) and the node is `node_id_2` in the `channel_announcement`
764-
message.
760+
- The `second_peer` is used to indicate which node in the channel node pair has
761+
created and signed this message. If present, the node was `node_id_2` in the
762+
`channel_announcment`, otherwise the node is `node_id_1` in the
763+
`channel_announcement` message.
765764
- `cltv_expiry_delta` is the number of blocks that the node will subtract from
766765
an incoming HTLC's `cltv_expiry`.
767766
- `htlc_minimum_msat` is the minimum HTLC value (in millisatoshi) that the
@@ -778,14 +777,13 @@ peer is offline.
778777
779778
#### TLV Defaults
780779
781-
For types 0, 6, 8, 10, 12, 14, 16 and 18, the following defaults apply if the
780+
For types 0, 6, 10, 12, 14, 16 and 18, the following defaults apply if the
782781
TLV is not present in the message:
783782
784783
| `channel_update_2` TLV Type | Default Value | Comment |
785784
|------------------------------------|--------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
786785
| 0 (`chain_hash`) | `6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000` | The hash of the genesis block of the mainnet Bitcoin blockchain. |
787786
| 6 (`disable`) | empty | |
788-
| 8 (`direction`) | false | |
789787
| 10 (`cltv_expiry_delta`) | 80 | |
790788
| 12 (`htlc_minimum_msat`) | 1 | |
791789
| 14 (`htlc_maximum_msat`) | floor(channel capacity / 2) | // TODO: remove this since makes encoding/decoding dependent on things outside the message? |
@@ -817,9 +815,9 @@ The origin node:
817815
- MUST set `chain_hash` AND `short_channel_id` to match the 32-byte hash AND
818816
8-byte channel ID that uniquely identifies the channel specified in the
819817
`channel_announcement_2` message.
820-
- MUST set `bip340_sig` to a valid [BIP340][bip-340] signature for its own
818+
- MUST set `signature` to a valid [BIP340][bip-340] signature for its own
821819
`node_id` key. The message to be signed is
822-
`MsgHash("channel_update_2", "bip340_sig", m)` where `m` is the serialised
820+
`MsgHash("channel_update_2", "signature", m)` where `m` is the serialised
823821
TLV stream of the `channel_update` (see the
824822
[`MsgHash`](#signature-message-construction) definition).
825823
- SHOULD NOT create redundant `channel_update_2`s.
@@ -834,7 +832,7 @@ The receiving node:
834832
channels.
835833
- SHOULD accept `channel_update_2`s for its own channels (even if non-public),
836834
in order to learn the associated origin nodes' forwarding parameters.
837-
- if `bip340_sig` is NOT a valid [BIP340][bip-340] signature (using `node_id`
835+
- if `signature` is NOT a valid [BIP340][bip-340] signature (using `node_id`
838836
over the message):
839837
- SHOULD send a `warning` and close the connection.
840838
- MUST NOT process the message further.
@@ -890,7 +888,7 @@ aggnonce = Musig2.NonceAgg(announcement_node_secnonce_1, announcement_bitcoin_pu
890888
```
891889
892890
The message, `msg` that the peers will sign is the serialisation of
893-
`channel_announcement_2` _without_ the `announcement_sig` field (i.e. without
891+
`channel_announcement_2` _without_ the `signature` field (i.e. without
894892
type 0)
895893
896894
With all the information mentioned, both peers can now construct the
@@ -1003,10 +1001,9 @@ The full list of inputs required:
10031001
- `node_id_2`
10041002
- `tr_output_key`
10051003
- `msg`: the serialised `channel_announcement_2` tlv stream.
1006-
- `sig`: the 64-byte BIP340 signature found in the
1007-
`channel_announcement_signature` field of the `channel_announcement_2`
1008-
message. This signature must be parsed into `R` and `s` values as defined in
1009-
BIP327.
1004+
- `sig`: the 64-byte BIP340 signature found in the `signature` field of the
1005+
`channel_announcement_2` message. This signature must be parsed into `R` and
1006+
`s` values as defined in BIP327.
10101007
10111008
The aggregate key can be calculated as follows:
10121009
@@ -1016,7 +1013,7 @@ P_agg = MuSig2.KeyAgg(MuSig2.KeySort(`node_id_1`, `node_id_2`, `tr_output_key`))
10161013
10171014
The signature can then be verified as follows:
10181015
- Let `pk` = `bytes(P_agg)` where the `bytes` function is defined in BIP340.
1019-
- Let `m` = `MsgHash("channel_announcement_2", "announcement_signature", msg)`
1016+
- Let `m` = `MsgHash("channel_announcement_2", "signature", msg)`
10201017
- Use the BIP340 `Verify` function to determine if the signature is valid by
10211018
passing in `pk`, `m` and `sig`.
10221019
@@ -1059,10 +1056,9 @@ The full list of inputs required:
10591056
- `bitcoin_key_1`
10601057
- `bitcoin_key_2`
10611058
- `msg`: the serialised `channel_announcement_2` tlv stream.
1062-
- `sig`: the 64-byte BIP340 signature found in the
1063-
`channel_announcement_signature` field of the `channel_announcement_2`
1064-
message. This signature must be parsed into `R` and `s` values as defined in
1065-
BIP327.
1059+
- `sig`: the 64-byte BIP340 signature found in the `signature` field of the
1060+
`channel_announcement_2` message. This signature must be parsed into `R` and
1061+
`s` values as defined in BIP327.
10661062
10671063
The aggregate key can be calculated as follows:
10681064
@@ -1072,7 +1068,7 @@ P_agg = MuSig2.KeyAgg(MuSig2.KeySort(`node_id_1`, `node_id_2`, `bitcoin_key_1`,
10721068
10731069
The signature can then be verified as follows:
10741070
- Let `pk` = `bytes(P_agg)` where the `bytes` function is defined in BIP340.
1075-
- Let `m` = `MsgHash("channel_announcement_2", "announcement_signature", msg)`
1071+
- Let `m` = `MsgHash("channel_announcement_2", "signature", msg)`
10761072
- Use the BIP340 `Verify` function to determine if the signature is valid by
10771073
passing in `pk`, `m` and `sig`.
10781074

0 commit comments

Comments
 (0)