From a7449360d323e6b47d47801fccd3b0c0bc93bd64 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Tue, 18 Aug 2026 10:17:54 +0200 Subject: [PATCH 1/2] tests: restart the node which owns the layer in node bias test test_node_bias_persistence() restarted l2, but the layer and its node bias records live in l1's datastore. The assert compared l1's in-memory layer against itself, so load_node_bias() was never actually exercised and this test could not have caught the startup crash in #9433. Restarting l1 instead makes the test reload the layer from the datastore at startup. This is the reproducer for #9433; it fails until the next commit. Signed-off-by: Vincenzo Palazzo --- tests/test_askrene.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_askrene.py b/tests/test_askrene.py index 1032cf8b092b..37281bee558c 100644 --- a/tests/test_askrene.py +++ b/tests/test_askrene.py @@ -498,7 +498,7 @@ def test_node_bias_persistence(node_factory): ] assert l1.rpc.askrene_listlayers("mylayer") == {"layers": [expect]} # restarting the node we see the same data again - l2.restart() + l1.restart() assert l1.rpc.askrene_listlayers("mylayer") == {"layers": [expect]} r = l1.rpc.askrene_bias_node( @@ -521,7 +521,7 @@ def test_node_bias_persistence(node_factory): assert l1.rpc.askrene_listlayers("mylayer") == {"layers": [expect]} # restarting the node we see the same data again - l2.restart() + l1.restart() assert l1.rpc.askrene_listlayers("mylayer") == {"layers": [expect]} From 5fc57d96bed13f4471d924e60d2e9d241686b4ec Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Tue, 18 Aug 2026 10:17:55 +0200 Subject: [PATCH 2/2] askrene: fix crash loading node bias with description load_node_bias() passed take(description) to two consecutive set_node_bias() calls. The first call's tal_strdup() consumes the take (tal_resize_ + tal_steal), so the second take() was on freed memory and we aborted in to_tal_hdr() with "Not a valid header" while loading the layer at startup. Since askrene is an important plugin, lightningd shuts down and the node cannot restart at all. The description is already a copy off tmpctx, so simply don't take() it: set_node_bias() strdups it into the bias anyway. With this, the test from the previous commit passes. Fixes: #9433 Reported-by: endothermicdev Changelog-Fixed: askrene: node failed to start (`exited before replying to init`) when a persistent layer contains a node bias with a description Signed-off-by: Vincenzo Palazzo --- plugins/askrene/layer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/askrene/layer.c b/plugins/askrene/layer.c index f3346ec01cae..61858900157f 100644 --- a/plugins/askrene/layer.c +++ b/plugins/askrene/layer.c @@ -773,10 +773,10 @@ static void load_node_bias(struct plugin *plugin, &in_bias, &out_bias, ×tamp)) { - set_node_bias(layer, &node, take(description), in_bias, + set_node_bias(layer, &node, description, in_bias, /* relative = */ false, /* out dir = */ false, timestamp); - set_node_bias(layer, &node, take(description), out_bias, + set_node_bias(layer, &node, description, out_bias, /* relative = */ false, /* out dir = */ true, timestamp); }