Skip to content
Open
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
2 changes: 1 addition & 1 deletion gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static void remove_channel(struct gossmap_manage *gm,

/* Maybe this was the last channel_announcement which preceeded node_announcement? */
if (chan->cann_off < node->nann_off
&& any_cannounce_preceeds_offset(gossmap, node, chan, node->nann_off)) {
&& !any_cannounce_preceeds_offset(gossmap, node, chan, node->nann_off)) {
const u8 *nannounce;
u32 timestamp;

Expand Down
4 changes: 4 additions & 0 deletions lightningd/chaintopology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,10 @@ static void fixup_scan_block(struct bitcoind *bitcoind,
struct bitcoin_block *blk,
struct chain_topology *topo)
{
/* Can't scan the block? We will try again next restart */
if (!blk)
return;

log_debug(topo->ld->log, "fixup_scan: block %u with %zu txs", height, tal_count(blk->tx));
topo_update_spends(topo, blk->tx, blk->txids, height);

Expand Down
18 changes: 18 additions & 0 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2370,3 +2370,21 @@ def test_incoming_unreasonable(node_factory):
wait_for(lambda: [c['updates']['remote']['fee_base_msat'] for c in l3.rpc.listpeerchannels()['channels']] == [100000000, 100000000])
l3.restart()
l3.rpc.listincoming()


def test_gossmap_lost_node(node_factory, bitcoind):
l1, l2, l3, l4 = node_factory.line_graph(4, wait_for_announce=True)

scid23 = only_one(l2.rpc.listpeerchannels(l3.info['id'])['channels'])['short_channel_id']
l2.rpc.close(l3.info['id'])
bitcoind.generate_block(13, wait_for_mempool=1)
wait_for(lambda: l1.rpc.listchannels(scid23) == {'channels': []})

pre_channels = l1.rpc.listchannels()
pre_nodes = l1.rpc.listnodes()
l1.restart()
post_channels = l1.rpc.listchannels()
post_nodes = l1.rpc.listnodes()

assert post_channels == pre_channels
assert post_nodes == pre_nodes
Loading