Skip to content

common: fix crash when we have a localmod with unrepresentable fee values #8187

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

Merged
merged 1 commit into from
Apr 1, 2025
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
9 changes: 5 additions & 4 deletions common/gossmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,11 @@ static void fill_from_update(struct gossmap *map,
|| hc->delay != delay) {
hc->htlc_max = 0;
hc->enabled = false;
logcb(cbarg, LOG_DBG,
"Bad cupdate for %s, ignoring (delta=%u, fee=%u/%u)",
fmt_short_channel_id_dir(tmpctx, scidd),
delay, base_fee, proportional_fee);
if (logcb)
logcb(cbarg, LOG_DBG,
"Bad cupdate for %s, ignoring (delta=%u, fee=%u/%u)",
fmt_short_channel_id_dir(tmpctx, scidd),
delay, base_fee, proportional_fee);
}
}

Expand Down
13 changes: 13 additions & 0 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2358,3 +2358,16 @@ def test_gossip_seeker_autoconnect(node_factory):
rf'{l3.info["id"]} for additional gossip')
l1.daemon.wait_for_log('gossipd: seeker: starting gossip')
assert l3.info['id'] in [n['id'] for n in l1.rpc.listpeers()['peers']]


def test_incoming_unreasonable(node_factory):
"""Don't crash if we have a local incoming channel with unreasonable (i.e. internally-unrepresentable) fees"""
l1, l2, l3, l4 = node_factory.line_graph(4,
wait_for_announce=True,
opts={'allow_bad_gossip': True})

l2.rpc.setchannel(l3.info['id'], 100000000)
l4.rpc.setchannel(l3.info['id'], 100000000)
wait_for(lambda: [c['updates']['remote']['fee_base_msat'] for c in l3.rpc.listpeerchannels()['channels']] == [100000000, 100000000])
l3.restart()
l3.rpc.listincoming()