You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 07-routing-gossip.md
+62-43Lines changed: 62 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -23,17 +23,17 @@ its fee levels and expiry using `channel_update`.
23
23
24
24
1. type: 256 (`MSG_CHANNEL_ANNOUNCEMENT`)
25
25
2. data:
26
-
* [4:blockheight]
27
-
* [3:blockindex]
28
-
* [1:outputindex]
29
-
* [33:node-id-1]
30
-
* [33:node-id-2]
31
-
* [33:bitcoin-key-1]
32
-
* [33:bitcoin-key-2]
33
-
* [64:bitcoin-signature-1]
34
-
* [64:bitcoin-signature-2]
35
-
* [64:node-signature-1]
36
-
* [64:node-signature-2]
26
+
*[4:blockheight]
27
+
*[3:blockindex]
28
+
*[1:outputindex]
29
+
*[33:node-id-1]
30
+
*[33:node-id-2]
31
+
*[33:bitcoin-key-1]
32
+
*[33:bitcoin-key-2]
33
+
*[64:bitcoin-signature-1]
34
+
*[64:bitcoin-signature-2]
35
+
*[64:node-signature-1]
36
+
*[64:node-signature-2]
37
37
38
38
### Requirements
39
39
@@ -51,14 +51,14 @@ ascending numerical order, and MUST set `bitcoin-key-1` and
51
51
respectively.
52
52
53
53
The creating node MUST set `bitcoin-signature-1` to the signature of
54
-
the double-SHA of `node-id-1` using `bitcoin-key-1`, and set
55
-
`bitcoin-signature-2` to the signature of the double-SHA of
54
+
the double-SHA256 of `node-id-1` using `bitcoin-key-1`, and set
55
+
`bitcoin-signature-2` to the signature of the double-SHA256 of
56
56
`node-id-2` using `bitcoin-key-2`
57
57
58
58
The creating node MUST set `node-signature-1` to the signature of the
59
-
double-SHA of every data field up to and including
59
+
double-SHA256 of every data field up to and including
60
60
`bitcoin-signature-2` using `node-id-1`, and `node-signature-2` to the
61
-
signature of the double-SHA of every data field up to and including
61
+
signature of the double-SHA256 of every data field up to and including
62
62
`bitcoin-signature-2` using `node-id-2`.
63
63
64
64
The receiving node MUST ignore the message if the output `outputindex`
@@ -78,9 +78,9 @@ Otherwise, if the transaction referred to was not previously announced
78
78
as a channel, the receiving node SHOULD queue the message for
79
79
rebroadcasting. If it has previously received a valid
80
80
`channel_announcement` for the same transaction in the same block, but
81
-
different `node-id-1` or `node-id-2`, it SHOULD blacklist the the
81
+
different `node-id-1` or `node-id-2`, it SHOULD blacklist the
82
82
previous message's `node-id-1` and `node-id-2` as well as this
83
-
`node-id-1` and `node-id-2` and forget channels conntected to them,
83
+
`node-id-1` and `node-id-2` and forget channels connected to them,
84
84
otherwise it SHOULD store this `channel_announcement`.
85
85
86
86
The receiving node SHOULD forget a channel once its funding output has
@@ -115,8 +115,7 @@ nodes for which a channel is not already known are ignored.
115
115
*[33:node-id]
116
116
*[3:rgb-color]
117
117
*[2:pad]
118
-
*[4:len]
119
-
*[len:alias]
118
+
*[32:alias]
120
119
121
120
The `timestamp` allows ordering in the case of multiple announcements;
122
121
the `ipv6` and `port` allow the node to announce its willingness to
@@ -130,21 +129,19 @@ The creating node MUST set `timestamp` to be greater than any previous
130
129
`node_announcement` it has created. It MAY base it on a UNIX
131
130
timestamp. It MUST set the `ipv6` and `port` fields to all zeroes, or
132
131
a non-zero `port` and `ipv6` set to a valid IPv6 address or an IPv4-Mapped IPv6 Address format as defined in [RFC 4291 section 2.5.5.2](https://tools.ietf.org/html/rfc4291#section-2.5.5.2). It MUST set `signature` to the signature of
133
-
the double-SHA of the entire remaining packet after `signature` using the
134
-
key given by `node-id`. It MUST set `pad` to zero. It MAY set `alias` and `rgb-color` to customize their node's appearance in maps and graphs, where the first byte of `rgb` is the red value, the second byte is the green value and the last byte is the blue value. It MUST set `alias` to a valid UTF-8 string.
135
-
136
-
The receiving node SHOULD fail the connection if the message is of
137
-
insufficent length to contain `alias`.
132
+
the double-SHA256 of the entire remaining packet after `signature` using the
133
+
key given by `node-id`. It MUST set `pad` to zero. It MAY set `alias` and `rgb-color` to customize their node's appearance in maps and graphs, where the first byte of `rgb` is the red value, the second byte is the green value and the last byte is the blue value. It MUST set `alias` to a valid UTF-8 string of up to 21 bytes in length, with all `alias` bytes following equal to zero.
138
134
139
135
The receiving node SHOULD fail the connection if `signature` is
140
136
invalid or incorrect for the entire message including unknown fields
141
137
following `alias`, and MUST NOT further process the message. The
142
-
receiving node SHOULD ignore `ipv6` if `port` is zero. It MUST ignore
138
+
receiving node SHOULD ignore `ipv6` if `port` is zero. It SHOULD fail
139
+
the connection if the final byte of `alias` is not zero. It MUST ignore
143
140
the contents of `pad`.
144
141
145
142
The receiving node SHOULD ignore the message if `node-id` is not
146
143
previously known from a `channel_announcement` message, or if
147
-
`timestamp` is not greater than than the last-received
144
+
`timestamp` is not greater than the last-received
148
145
`node_announcement` from this `node-id`. Otherwise, if the
149
146
`timestamp` is greater than the last-received `node_announcement` from
150
147
this `node-id` the receiving node SHOULD queue the message for
@@ -173,22 +170,22 @@ it wants to change fees.
173
170
174
171
1. type: 258 (`MSG_CHANNEL_UPDATE`)
175
172
2. data:
176
-
* [64:signature]
177
-
* [4:blockheight]
178
-
* [3:blockindex]
179
-
* [1:outputindex]
180
-
* [4:timestamp]
181
-
* [1:side]
182
-
* [1:pad]
173
+
*[64:signature]
174
+
*[4:blockheight]
175
+
*[3:blockindex]
176
+
*[1:outputindex]
177
+
*[4:timestamp]
178
+
*[1:side]
179
+
*[1:pad]
183
180
*[2:expiry]
184
-
* [4:htlc-minimum-msat]
185
-
* [4:fee-base-msat]
186
-
* [4:fee-proportional-millionths]
181
+
*[4:htlc-minimum-msat]
182
+
*[4:fee-base-msat]
183
+
*[4:fee-proportional-millionths]
187
184
188
185
### Requirements
189
186
190
187
The creating node MUST set `signature` to the signature of the
191
-
double-SHA of the entire remaining packet after `signature` using its own `node-id`.
188
+
double-SHA256 of the entire remaining packet after `signature` using its own `node-id`.
192
189
193
190
The creating node MUST set `blockheight`, `blockindex` and `outputindex` to
194
191
match those in the already-sent `channel_announcement` message, and MUST set `side` to 0 if the creating node is `node-id-1` in that message, otherwise 1.
@@ -197,10 +194,6 @@ The creating node MUST set `timestamp` to greater than zero, and MUST set it to
197
194
198
195
It MUST set `expiry` to the number of blocks it will subtract from an incoming HTLC's `expiry`. It MUST set `htlc-minimum-msat` to the minimum HTLC value it will accept, in millisatoshi. It MUST set `fee-base-msat` to the base fee it will charge for any HTLC, in millisatoshi, and `fee-proportional-millionths` to the amount it will charge per millionth of a satoshi.
199
196
200
-
The node SHOULD accept HTLCs which pay a fee equal or greater than:
The receiving node SHOULD fail the connection if `side` is not 0 or 1.
205
198
It MUST ignore the contents of `pad`. The receiving node SHOULD fail
206
199
the connection if `signature` is invalid or incorrect for the entire
@@ -218,9 +211,10 @@ queue the message for rebroadcasting.
218
211
219
212
## Rebroadcasting
220
213
221
-
Nodes receiving an announcement verify that this is the latest update from the announcing node by comparing the included timestamp and update their local view of the network's topology accordingly.
214
+
Nodes receiving a new `channel_announcement` or a `channel_update` or
215
+
`node_update` with an updated timestamp update their local view of the network's topology accordingly.
222
216
223
-
Once the announcement has been processed it is added to a list of outgoing announcements to the processing node's peers, which will be flushed at regular intervals.
217
+
Once the announcement has been processed it is added to a list of outgoing announcements (perhaps replacing older updates) to the processing node's peers, which will be flushed at regular intervals.
224
218
This store and delayed forward broadcast is called a _staggered broadcast_
225
219
226
220
If, after applying the changes from the announcement, there are no channels associated with the announcing node, then the receiving node MAY purge the announcing node from the set of known nodes.
@@ -247,6 +241,31 @@ The sending of all announcements on reconnection is naive, but simple,
247
241
and allows bootstrap for new nodes as well as updating for nodes which
248
242
have been offline for some time.
249
243
244
+
## HTLC Fees
245
+
246
+
The node creating `channel_update` SHOULD accept HTLCs which pay a fee equal or greater than:
0 commit comments