Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reallow no gossip queries #7174

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion gossipd/seeker.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ static void normal_gossip_start(struct seeker *seeker, struct peer *peer)
{
bool enable_stream = false;

/* BOLT-remove-old-features #7:
* Understanding of messages used to be indicated with the `gossip_queries`
* feature bit; now these messages are universally supported, that feature has
* now been slightly repurposed. Not offering this feature means a node is not
* worth querying for gossip: either they do not store the entire gossip map, or
* they are only connected to a single peer (this one).
*/
if (!peer->gossip_queries_feature)
return;

/* Make this one of our streaming gossipers if we aren't full */
for (size_t i = 0; i < ARRAY_SIZE(seeker->gossiper); i++) {
if (seeker->gossiper[i] == NULL) {
Expand Down Expand Up @@ -850,6 +860,13 @@ static bool peer_is_not_gossipper(const struct peer *peer)
{
const struct seeker *seeker = peer->daemon->seeker;

/* BOLT-remove-old-features #7:
* `gossip_queries`... Not offering this feature means a node is not
* worth querying for gossip
*/
if (!peer->gossip_queries_feature)
return false;

for (size_t i = 0; i < ARRAY_SIZE(seeker->gossiper); i++) {
if (seeker->gossiper[i] == peer)
return false;
Expand All @@ -864,7 +881,7 @@ static void maybe_rotate_gossipers(struct seeker *seeker)
struct peer *peer;
size_t i;

/* If all peers are gossiping, we're done */
/* If all (usable) peers are gossiping, we're done */
peer = random_seeker(seeker, peer_is_not_gossipper);
if (!peer)
return;
Expand Down
2 changes: 1 addition & 1 deletion lightningd/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ static struct feature_set *default_features(const tal_t *ctx)
static const u32 features[] = {
COMPULSORY_FEATURE(OPT_DATA_LOSS_PROTECT),
OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
COMPULSORY_FEATURE(OPT_GOSSIP_QUERIES),
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
COMPULSORY_FEATURE(OPT_VAR_ONION),
COMPULSORY_FEATURE(OPT_PAYMENT_SECRET),
OPTIONAL_FEATURE(OPT_BASIC_MPP),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,7 @@ def test_list_features_only(node_factory):
'--list-features-only']).decode('utf-8').splitlines()
expected = ['option_data_loss_protect/even',
'option_upfront_shutdown_script/odd',
'option_gossip_queries/even',
'option_gossip_queries/odd',
'option_var_onion_optin/even',
'option_gossip_queries_ex/odd',
'option_static_remotekey/even',
Expand Down
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def hex_bits(features):

def expected_peer_features(extra=[]):
"""Return the expected peer features hexstring for this configuration"""
features = [0, 5, 6, 8, 11, 12, 14, 17, 19, 25, 27, 45, 47, 51]
features = [0, 5, 7, 8, 11, 12, 14, 17, 19, 25, 27, 45, 47, 51]
if EXPERIMENTAL_DUAL_FUND:
# option_dual_fund
features += [29]
Expand All @@ -53,7 +53,7 @@ def expected_peer_features(extra=[]):
# features for the 'node' and the 'peer' feature sets
def expected_node_features(extra=[]):
"""Return the expected node features hexstring for this configuration"""
features = [0, 5, 6, 8, 11, 12, 14, 17, 19, 25, 27, 45, 47, 51, 55]
features = [0, 5, 7, 8, 11, 12, 14, 17, 19, 25, 27, 45, 47, 51, 55]
if EXPERIMENTAL_DUAL_FUND:
# option_dual_fund
features += [29]
Expand Down
Loading