Browse Source

gossip: Only backfill blocks that are below our birth height

If we were to just insert filtered blocks in the range that we will scan later
we'd be hitting the uniqueness constraints later.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
pull/2938/head
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
379079c5f3
  1. 4
      lightningd/gossip_control.c

4
lightningd/gossip_control.c

@ -67,7 +67,9 @@ static void got_filteredblock(struct bitcoind *bitcoind,
struct filteredblock_outpoint *fbo = NULL, *o;
struct bitcoin_tx_output txo;
wallet_filteredblock_add(bitcoind->ld->wallet, fb);
/* Only fill in blocks that we are not going to scan later. */
if (bitcoind->ld->topology->min_blockheight > fb->height)
wallet_filteredblock_add(bitcoind->ld->wallet, fb);
u32 outnum = short_channel_id_outnum(scid);
u32 txindex = short_channel_id_txnum(scid);

Loading…
Cancel
Save