From 06cf5ac841a61aebc2e65451ba30526ff51e90d7 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 19 Jun 2024 10:06:41 +0930 Subject: [PATCH] Doc: update bolts to assume gossip_queries under the new meaning. Everyone understands gossip_queries now, but peers leave it unset to indicate they have nothing useful to say. Signed-off-by: Rusty Russell --- Makefile | 2 +- common/features.c | 3 --- common/features.h | 2 +- connectd/multiplex.c | 13 +------------ gossipd/gossmap_manage.c | 2 +- gossipd/queries.c | 13 +++++++------ 6 files changed, 11 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 62fb7fbfb..01a153bbb 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ CCANDIR := ccan # Where we keep the BOLT RFCs BOLTDIR := ../bolts/ -DEFAULT_BOLTVERSION := e042c615efb5139a0bfdca0c6391c3c13df70418 +DEFAULT_BOLTVERSION := fce8bab931674a81a9ea895c9e9162e559e48a65 # Can be overridden on cmdline. BOLTVERSION := $(DEFAULT_BOLTVERSION) diff --git a/common/features.c b/common/features.c index c039fce88..17e95ab3c 100644 --- a/common/features.c +++ b/common/features.c @@ -157,11 +157,8 @@ static const struct dependency feature_deps[] = { /* BOLT #9: * Name | Description | Context | Dependencies | *... - * `gossip_queries_ex` | ... | ... | `gossip_queries` | - *... * `basic_mpp` | ... | ... | `payment_secret` | */ - { OPT_GOSSIP_QUERIES_EX, OPT_GOSSIP_QUERIES }, { OPT_BASIC_MPP, OPT_PAYMENT_SECRET }, }; diff --git a/common/features.h b/common/features.h index c304097e3..0474ed00d 100644 --- a/common/features.h +++ b/common/features.h @@ -105,7 +105,7 @@ struct feature_set *feature_set_dup(const tal_t *ctx, * | 0/1 | `option_data_loss_protect` |... ASSUMED ... * | 3 | `initial_routing_sync` |... I ... * | 4/5 | `option_upfront_shutdown_script` |... IN ... - * | 6/7 | `gossip_queries` |... IN ... + * | 6/7 | `gossip_queries` |... * | 8/9 | `var_onion_optin` |... ASSUMED ... * | 10/11 | `gossip_queries_ex` |... IN ... * | 12/13 | `option_static_remotekey` |... ASSUMED ... diff --git a/connectd/multiplex.c b/connectd/multiplex.c index 6ee1e98fd..1fd4dab0e 100644 --- a/connectd/multiplex.c +++ b/connectd/multiplex.c @@ -262,7 +262,6 @@ void setup_peer_gossip_store(struct peer *peer, /* BOLT #7: * * A node: - * - if the `gossip_queries` feature is negotiated: * - MUST NOT relay any gossip messages it did not generate itself, * unless explicitly requested. */ @@ -278,17 +277,7 @@ void setup_peer_gossip_store(struct peer *peer, peer->gs.timestamp_min = 0; peer->gs.timestamp_max = UINT32_MAX; - /* BOLT #7: - * - * - upon receiving an `init` message with the - * `initial_routing_sync` flag set to 1: - * - SHOULD send gossip messages for all known channels and - * nodes, as if they were just received. - * - if the `initial_routing_sync` flag is set to 0, OR if the - * initial sync was completed: - * - SHOULD resume normal operation, as specified in the - * following [Rebroadcasting](#rebroadcasting) section. - */ + /* We still respect this old bit, though spec part was removed. */ if (feature_offered(their_features, OPT_INITIAL_ROUTING_SYNC)) peer->gs.off = 1; else { diff --git a/gossipd/gossmap_manage.c b/gossipd/gossmap_manage.c index 79d43e3ce..1e973f7ea 100644 --- a/gossipd/gossmap_manage.c +++ b/gossipd/gossmap_manage.c @@ -1303,7 +1303,7 @@ struct gossmap *gossmap_manage_get_gossmap(struct gossmap_manage *gm) } /* BOLT #7: - * - if the `gossip_queries` feature is negotiated: + * A node: * - MUST NOT relay any gossip messages it did not generate itself, * unless explicitly requested. */ diff --git a/gossipd/queries.c b/gossipd/queries.c index c33bb9670..a282abddf 100644 --- a/gossipd/queries.c +++ b/gossipd/queries.c @@ -73,7 +73,7 @@ bool query_short_channel_ids(struct daemon *daemon, struct tlv_query_short_channel_ids_tlvs *tlvs; /* BOLT #7: * - * 1. type: 261 (`query_short_channel_ids`) (`gossip_queries`) + * 1. type: 261 (`query_short_channel_ids`) * 2. data: * * [`chain_hash`:`chain_hash`] * * [`u16`:`len`] @@ -82,10 +82,6 @@ bool query_short_channel_ids(struct daemon *daemon, const size_t reply_overhead = 32 + 2; size_t max_encoded_bytes = 65535 - 2 - reply_overhead; - /* Can't query if they don't have gossip_queries_feature */ - if (!peer->gossip_queries_feature) - return false; - /* BOLT #7: * - MAY include an optional `query_flags`. If so: * - MUST set `encoding_type`, as for `encoded_short_ids`. @@ -98,10 +94,15 @@ bool query_short_channel_ids(struct daemon *daemon, /* BOLT #7: * * The sender: + * - SHOULD NOT send this to a peer which does not offer `gossip_queries`. * - MUST NOT send `query_short_channel_ids` if it has sent a previous * `query_short_channel_ids` to this peer and not received * `reply_short_channel_ids_end`. */ + /* Don't query if they have no useful gossip */ + if (!peer->gossip_queries_feature) + return false; + if (peer->scid_query_outstanding) return false; @@ -419,7 +420,7 @@ static size_t max_entries(enum query_option_flags query_option_flags) { /* BOLT #7: * - * 1. type: 264 (`reply_channel_range`) (`gossip_queries`) + * 1. type: 264 (`reply_channel_range`) * 2. data: * * [`chain_hash`:`chain_hash`] * * [`u32`:`first_blocknum`]