Skip to content

Commit

Permalink
Doc: update bolts to assume gossip_queries under the new meaning.
Browse files Browse the repository at this point in the history
Everyone understands gossip_queries now, but peers leave it unset to indicate
they have nothing useful to say.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jun 19, 2024
1 parent 65ef909 commit 06cf5ac
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions common/features.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};

Expand Down
2 changes: 1 addition & 1 deletion common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down
13 changes: 1 addition & 12 deletions connectd/multiplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
13 changes: 7 additions & 6 deletions gossipd/queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand All @@ -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`.
Expand All @@ -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;

Expand Down Expand Up @@ -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`]
Expand Down

0 comments on commit 06cf5ac

Please sign in to comment.