Skip to content

Commit 8dae8be

Browse files
committed
common: fix crash when we have a localmod with unrepresentable fee values.
We handed NULL as the logcb, resulting in a very uninformative crash: ``` 2025-03-14T03:46:36.447Z INFO lightningd: Server started with public key 03d67f36c4f81789e2fe425028bacc96b199813eae426c517f589a45f1136c1fe5, alias Jubilee (color #dc42f4) and lightningd v25.02 topology: FATAL SIGNAL 11 (version v25.02) 0x560037f64aad send_backtrace common/daemon.c:33 0x560037f64b49 crashdump common/daemon.c:78 0x7f6c41ff351f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x0 ??? ???:0 ``` Changelog-Fixed: `topology` crash on invoice creation if a peer had a really high feerate. Fixes: #8156 Signed-off-by: Rusty Russell <[email protected]>
1 parent f38cc0e commit 8dae8be

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

common/gossmap.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,11 @@ static void fill_from_update(struct gossmap *map,
551551
|| hc->delay != delay) {
552552
hc->htlc_max = 0;
553553
hc->enabled = false;
554-
logcb(cbarg, LOG_DBG,
555-
"Bad cupdate for %s, ignoring (delta=%u, fee=%u/%u)",
556-
fmt_short_channel_id_dir(tmpctx, scidd),
557-
delay, base_fee, proportional_fee);
554+
if (logcb)
555+
logcb(cbarg, LOG_DBG,
556+
"Bad cupdate for %s, ignoring (delta=%u, fee=%u/%u)",
557+
fmt_short_channel_id_dir(tmpctx, scidd),
558+
delay, base_fee, proportional_fee);
558559
}
559560
}
560561

tests/test_gossip.py

+13
Original file line numberDiff line numberDiff line change
@@ -2358,3 +2358,16 @@ def test_gossip_seeker_autoconnect(node_factory):
23582358
rf'{l3.info["id"]} for additional gossip')
23592359
l1.daemon.wait_for_log('gossipd: seeker: starting gossip')
23602360
assert l3.info['id'] in [n['id'] for n in l1.rpc.listpeers()['peers']]
2361+
2362+
2363+
def test_incoming_unreasonable(node_factory):
2364+
"""Don't crash if we have a local incoming channel with unreasonable (i.e. internally-unrepresentable) fees"""
2365+
l1, l2, l3, l4 = node_factory.line_graph(4,
2366+
wait_for_announce=True,
2367+
opts={'allow_bad_gossip': True})
2368+
2369+
l2.rpc.setchannel(l3.info['id'], 100000000)
2370+
l4.rpc.setchannel(l3.info['id'], 100000000)
2371+
wait_for(lambda: [c['updates']['remote']['fee_base_msat'] for c in l3.rpc.listpeerchannels()['channels']] == [100000000, 100000000])
2372+
l3.restart()
2373+
l3.rpc.listincoming()

0 commit comments

Comments
 (0)