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>
This commit is contained in:
Christian Decker
2019-08-06 20:39:02 +02:00
committed by Rusty Russell
parent 95d891ebf1
commit 379079c5f3

View File

@@ -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);