From 35f1f47e28def0fc47e60c2c8a876a64e4e8631a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 3 Oct 2019 14:23:09 +0930 Subject: [PATCH] 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 --- 01-messaging.md | 17 +++++++++++++++++ 07-routing-gossip.md | 2 ++ 2 files changed, 19 insertions(+) diff --git a/01-messaging.md b/01-messaging.md index 7fd3e2707..60c054a83 100644 --- a/01-messaging.md +++ b/01-messaging.md @@ -236,8 +236,17 @@ The `features` field MUST be padded to bytes with 0s. * [`gflen*byte`:`globalfeatures`] * [`u16`:`flen`] * [`flen*byte`:`features`] + * [`init_tlvs`:`tlvs`] + +1. tlvs: `init_tlvs` +2. types: + 1. type: 1 (`networks`) + 2. data: + * [`...*chain_hash`:`chains`] +The optional `networks` indicates the chains the node is interested in. + #### Requirements The sending node: @@ -246,6 +255,7 @@ The sending node: - MUST set any undefined feature bits to 0. - SHOULD NOT set features greater than 13 in `globalfeatures`. - SHOULD use the minimum length required to represent the `features` field. + - SHOULD set `networks` to all chains it will gossip or open channels for. The receiving node: - MUST wait to receive `init` before sending any other messages. @@ -255,6 +265,8 @@ The receiving node: - MUST ignore the bit. - upon receiving unknown _even_ feature bits that are non-zero: - MUST fail the connection. + - upon receiving `networks` containing no common chains + - MAY fail the connection. #### Rationale @@ -266,6 +278,11 @@ This semantic allows both future incompatible changes and future backward compat Nodes wait for receipt of the other's features to simplify error diagnosis when features are incompatible. +Since all networks share the same port, but most implementations only +support a single network, the `networks` fields avoids nodes +erroneously believing they will receive updates about their preferred +network, or that they can open channels. + ### The `error` Message For simplicity of diagnosis, it's often useful to tell a peer that something is incorrect. diff --git a/07-routing-gossip.md b/07-routing-gossip.md index ab4ece066..ba2a45faa 100644 --- a/07-routing-gossip.md +++ b/07-routing-gossip.md @@ -906,6 +906,8 @@ A node: the arrival times of the messages. - Note: this results in staggered announcements that are unique (not duplicated). + - SHOULD NOT forward gossip messages to peers who sent `networks` in `init` + and did not specify the `chain_hash` of this gossip message. - MAY re-announce its channels regularly. - Note: this is discouraged, in order to keep the resource requirements low. - upon connection establishment: