@@ -12,19 +12,24 @@ updates are known.
12
12
13
13
Essentially, the serialization structure is as follows:
14
14
15
- 1 . Fixed prefix bytes ` 76, 68, 75, 1 ` (the first three bytes are ASCII for ` LDK ` )
15
+ 1 . Fixed prefix bytes ` 76, 68, 75 ` (the first three bytes are ASCII for ` LDK ` )
16
16
- The purpose of this prefix is to identify the serialization format, should other rapid gossip
17
17
sync formats arise in the future
18
- - The fourth byte is the protocol version in case our format gets updated
19
- 2 . Chain hash (32 bytes)
20
- 3 . Latest seen timestamp (` u32 ` )
21
- 4 . An unsigned int indicating the number of node IDs to follow
22
- 5 . An array of compressed node ID pubkeys (all pubkeys are presumed to be standard
18
+ 2 . Version byte
19
+ - Currently supported versions are 1 and 2
20
+ 3 . Chain hash (32 bytes)
21
+ 4 . Latest seen timestamp (` u32 ` )
22
+ 5 . Version 2 only:
23
+ - A byte indicating the number of default node features
24
+ - An array of node features
25
+ 6 . An unsigned int indicating the number of node IDs to follow
26
+ 7 . An array of compressed node ID pubkeys (all pubkeys are presumed to be standard
23
27
compressed 33-byte-serializations)
24
- 6 . An unsigned int indicating the number of channel announcement messages to follow
25
- 7 . An array of significantly stripped down customized channel announcements
26
- 8 . An unsigned int indicating the number of channel update messages to follow
27
- 9 . A series of default values used for non-incremental channel updates
28
+ - Version 2 only: Each pubkey is optionally followed by supplemental feature or address information.
29
+ 8 . An unsigned int indicating the number of channel announcement messages to follow
30
+ 9 . An array of significantly stripped down customized channel announcements
31
+ 10 . An unsigned int indicating the number of channel update messages to follow
32
+ 11 . A series of default values used for non-incremental channel updates
28
33
- The values are defined as follows:
29
34
1 . ` default_cltv_expiry_delta `
30
35
2 . ` default_htlc_minimum_msat `
@@ -33,7 +38,7 @@ Essentially, the serialization structure is as follows:
33
38
5 . ` default_htlc_maximum_msat ` (` u64 ` , and if the default is no maximum, ` u64::MAX ` )
34
39
- The defaults are calculated by the server based on the frequency among non-incremental
35
40
updates within a given delta set
36
- 10 . An array of customized channel updates
41
+ 12 . An array of customized channel updates
37
42
38
43
You will also notice that ` NodeAnnouncement ` messages are omitted altogether as the node IDs are
39
44
implicitly extracted from the channel announcements and updates.
@@ -42,6 +47,25 @@ The data is then applied to the current network graph, artificially dated to the
42
47
latest seen message less one week, be it an announcement or an update, from the server's
43
48
perspective. The network graph should not be pruned until the graph sync completes.
44
49
50
+ ### Custom Node Announcement (V2 Only)
51
+
52
+ In version 2 of the RGS protocol, node IDs may be followed by supplemental feature and socket address data. The presence
53
+ of those additional fields is indicated by utilizing the unused bits of the 33-byte-pubkey parity byte as follows:
54
+
55
+ | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
56
+ | -----------------| ----------| --------------| --------------| --------------| --------------| ------------| ------------------|
57
+ | Additional data | Reminder | Feature data | Feature data | Feature data | Address data | Always set | Odd y-coordinate |
58
+
59
+ Note that bit indices 3-5 all indicate feature data. Specifically, if none of the bits are set, that means there is
60
+ no feature data that follows the pubkey. If a subset of them are set, the bit triplet is interpreted as an index (less
61
+ one) of the default node features that were supplied prior. If all three bits are set, a custom feature combination is
62
+ sent.
63
+
64
+ If there have been no changes to a node, bit index 6 can be set to function as a reminder absent any address or feature
65
+ data.
66
+
67
+ Lastly, bit index 7 indicates the presence of additional data, which will allow forwards compatibility.
68
+
45
69
### Custom Channel Announcement
46
70
47
71
To achieve compactness and avoid data repetition, we're sending a significantly stripped down
0 commit comments