Skip to content

Commit ac596c8

Browse files
rustyrussellendothermicdev
authored andcommitted
offers: don't add blinded path from a disconnected peer.
Really, any peer without a live channel is a bad prospect. This requires us to wire the "enabled" flag through listincoming: fortunately that's an internal, undocumented interface, so we don't have a schema change. Changelog-Fixed: Offline peers no longer selected for blinded paths.. Signed-off-by: Rusty Russell <[email protected]> Fixes: #8127
1 parent d47b188 commit ac596c8

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

plugins/offers.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ static struct command_result *listincoming_done(struct command *cmd,
339339
u8 *features;
340340
const char *err;
341341
struct amount_msat feebase;
342+
bool enabled;
342343

343344
err = json_scan(tmpctx, buf, t,
344345
"{id:%,"
@@ -347,14 +348,16 @@ static struct command_result *listincoming_done(struct command *cmd,
347348
"htlc_max_msat:%,"
348349
"fee_base_msat:%,"
349350
"fee_proportional_millionths:%,"
350-
"cltv_expiry_delta:%}",
351+
"cltv_expiry_delta:%,"
352+
"enabled:%}",
351353
JSON_SCAN(json_to_pubkey, &ci.id),
352354
JSON_SCAN(json_to_msat, &ci.capacity),
353355
JSON_SCAN(json_to_msat, &ci.htlc_min),
354356
JSON_SCAN(json_to_msat, &ci.htlc_max),
355357
JSON_SCAN(json_to_msat, &feebase),
356358
JSON_SCAN(json_to_u32, &ci.feeppm),
357-
JSON_SCAN(json_to_u32, &ci.cltv));
359+
JSON_SCAN(json_to_u32, &ci.cltv),
360+
JSON_SCAN(json_to_bool, &enabled));
358361
if (err) {
359362
plugin_log(cmd->plugin, LOG_BROKEN,
360363
"Could not parse listincoming: %s",
@@ -363,6 +366,10 @@ static struct command_result *listincoming_done(struct command *cmd,
363366
}
364367
ci.feebase = feebase.millisatoshis; /* Raw: feebase */
365368

369+
/* Don't pick a peer which is disconnected */
370+
if (!enabled)
371+
continue;
372+
366373
/* Not presented if there's no channel_announcement for peer:
367374
* we could use listpeers, but if it's private we probably
368375
* don't want to blinded route through it! */

plugins/topology.c

+1
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ listpeerchannels_listincoming_done(struct command *cmd,
670670
peer_features = gossmap_node_get_features(tmpctx, gossmap, peer);
671671
if (peer_features)
672672
json_add_hex_talarr(js, "peer_features", peer_features);
673+
json_add_bool(js, "enabled", ourchan->half[!dir].enabled);
673674
json_object_end(js);
674675
}
675676
done:

tests/test_pay.py

-1
Original file line numberDiff line numberDiff line change
@@ -5679,7 +5679,6 @@ def test_blindedpath_privchan(node_factory, bitcoind):
56795679
l1.rpc.pay(inv['invoice'])
56805680

56815681

5682-
@pytest.mark.xfail(strict=True)
56835682
def test_blindedpath_noaddr(node_factory, bitcoind):
56845683
l1, l2 = node_factory.line_graph(2, wait_for_announce=True,
56855684
opts={'dev-allow-localhost': None})

0 commit comments

Comments
 (0)