Skip to content

Commit 35f1f47

Browse files
committed
BOLT 1: add networks to init message.
This has been discussed for forever, but now we have TLVs the correct encoding seems obvious. Signed-off-by: Rusty Russell <[email protected]>
1 parent 4c3d016 commit 35f1f47

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

01-messaging.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,17 @@ The `features` field MUST be padded to bytes with 0s.
236236
* [`gflen*byte`:`globalfeatures`]
237237
* [`u16`:`flen`]
238238
* [`flen*byte`:`features`]
239+
* [`init_tlvs`:`tlvs`]
240+
241+
1. tlvs: `init_tlvs`
242+
2. types:
243+
1. type: 1 (`networks`)
244+
2. data:
245+
* [`...*chain_hash`:`chains`]
239246

240247

248+
The optional `networks` indicates the chains the node is interested in.
249+
241250
#### Requirements
242251

243252
The sending node:
@@ -246,6 +255,7 @@ The sending node:
246255
- MUST set any undefined feature bits to 0.
247256
- SHOULD NOT set features greater than 13 in `globalfeatures`.
248257
- SHOULD use the minimum length required to represent the `features` field.
258+
- SHOULD set `networks` to all chains it will gossip or open channels for.
249259

250260
The receiving node:
251261
- MUST wait to receive `init` before sending any other messages.
@@ -255,6 +265,8 @@ The receiving node:
255265
- MUST ignore the bit.
256266
- upon receiving unknown _even_ feature bits that are non-zero:
257267
- MUST fail the connection.
268+
- upon receiving `networks` containing no common chains
269+
- MAY fail the connection.
258270

259271
#### Rationale
260272

@@ -266,6 +278,11 @@ This semantic allows both future incompatible changes and future backward compat
266278
Nodes wait for receipt of the other's features to simplify error
267279
diagnosis when features are incompatible.
268280

281+
Since all networks share the same port, but most implementations only
282+
support a single network, the `networks` fields avoids nodes
283+
erroneously believing they will receive updates about their preferred
284+
network, or that they can open channels.
285+
269286
### The `error` Message
270287

271288
For simplicity of diagnosis, it's often useful to tell a peer that something is incorrect.

07-routing-gossip.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,8 @@ A node:
906906
the arrival times of the messages.
907907
- Note: this results in staggered announcements that are unique (not
908908
duplicated).
909+
- SHOULD NOT forward gossip messages to peers who sent `networks` in `init`
910+
and did not specify the `chain_hash` of this gossip message.
909911
- MAY re-announce its channels regularly.
910912
- Note: this is discouraged, in order to keep the resource requirements low.
911913
- upon connection establishment:

0 commit comments

Comments
 (0)