Skip to content

Commit 868bc5d

Browse files
committed
pytest: fix test_xpay_fake_channeld flake
Also, resulting log was huge, so suppress log level (will probably speed test) ``` 2025-09-02T06:01:39.4881086Z > l1.rpc.plugin_start(os.path.join(os.getcwd(), 'plugins/cln-askrene')) 2025-09-02T06:01:39.4881090Z 2025-09-02T06:01:39.4881174Z tests/test_xpay.py:279: ... 2025-09-02T06:01:39.4883193Z > self.sock.connect(str(self.path)) 2025-09-02T06:01:39.4883340Z E ConnectionRefusedError: [Errno 111] Connection refused ... 2025-09-02T06:01:41.7767610Z lightningd-1 2025-09-02T06:01:27.235Z **BROKEN** plugin-cln-xpay: askrene-age failed with {"code":-4, "message":"Plugin terminated before replying to RPC call."} 2025-09-02T06:01:41.7768127Z lightningd-1 2025-09-02T06:01:27.305Z INFO plugin-cln-xpay: Killing plugin: exited during normal operation ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 8449b83 commit 868bc5d

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

plugins/xpay/xpay.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ struct xpay {
3838
bool take_over_pay;
3939
/* Are we to wait for all parts to complete before returning? */
4040
bool slow_mode;
41+
/* Suppress calls to askrene-age */
42+
bool dev_no_age;
4143
};
4244

4345
static struct xpay *xpay_of(struct plugin *plugin)
@@ -2098,6 +2100,10 @@ static struct command_result *age_layer(struct command *timer_cmd, void *unused)
20982100

20992101
static void start_aging_timer(struct plugin *plugin)
21002102
{
2103+
struct xpay *xpay = xpay_of(plugin);
2104+
2105+
if (xpay->dev_no_age)
2106+
return;
21012107
notleak(global_timer(plugin, time_from_sec(60), age_layer, NULL));
21022108
}
21032109

@@ -2422,6 +2428,7 @@ int main(int argc, char *argv[])
24222428
xpay = tal(NULL, struct xpay);
24232429
xpay->take_over_pay = false;
24242430
xpay->slow_mode = false;
2431+
xpay->dev_no_age = false;
24252432
plugin_main(argv, init, take(xpay),
24262433
PLUGIN_RESTARTABLE, true, NULL,
24272434
commands, ARRAY_SIZE(commands),
@@ -2434,5 +2441,8 @@ int main(int argc, char *argv[])
24342441
plugin_option_dynamic("xpay-slow-mode", "bool",
24352442
"Wait until all parts have completed before returning success or failure",
24362443
bool_option, bool_jsonfmt, &xpay->slow_mode),
2444+
plugin_option_dev("dev-xpay-no-age", "flag",
2445+
"Don't call askrene-age",
2446+
flag_option, flag_jsonfmt, &xpay->dev_no_age),
24372447
NULL);
24382448
}

tests/test_xpay.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,21 @@ def test_xpay_fake_channeld(node_factory, bitcoind, chainparams, slow_mode):
227227

228228
# l2 will warn l1 about its invalid gossip: ignore.
229229
# We throttle l1's gossip to avoid massive log spam.
230+
# Suppress debug and below because logs are huge
230231
l1, l2 = node_factory.line_graph(2,
231232
# This is in sats, so 1000x amount we send.
232233
fundamount=AMOUNT,
233234
opts=[{'gossip_store_file': outfile.name,
234235
'subdaemon': 'channeld:../tests/plugins/channeld_fakenet',
235236
'allow_warning': True,
236-
'dev-throttle-gossip': None},
237-
{'allow_bad_gossip': True}])
237+
'dev-throttle-gossip': None,
238+
'log-level': 'info',
239+
# xpay gets upset if it's aging when we remove cln-askrene!
240+
'dev-xpay-no-age': None,
241+
},
242+
{'allow_bad_gossip': True,
243+
'log-level': 'info',
244+
}])
238245

239246
# l1 needs to know l2's shaseed for the channel so it can make revocations
240247
hsmfile = os.path.join(l2.daemon.lightning_dir, TEST_NETWORK, "hsm_secret")

0 commit comments

Comments
 (0)