From 7bbc1948f7f88cbab82e38744e013030e6a78b6f Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Thu, 15 Mar 2018 23:23:14 +0000 Subject: [PATCH] chaintopology: Add missing `block_map_del`. We would `block_map_add` inside `add_tip`, but we never `block_map_del` inside `remove_tip`, which is dangerous as we actually `tal_free` the block inside `remove_tip`. Our CI did not reliably trap this problem since block hashes are random and rerunning the `test_blockchaintrack` often passed spuriously. --- lightningd/chaintopology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lightningd/chaintopology.c b/lightningd/chaintopology.c index be3e4d64e..c41a73fa1 100644 --- a/lightningd/chaintopology.c +++ b/lightningd/chaintopology.c @@ -440,6 +440,7 @@ static void remove_tip(struct chain_topology *topo) txwatch_fire(topo, b->txs[i], 0); wallet_block_remove(topo->wallet, b); + block_map_del(&topo->block_map, b); tal_free(b); }