From 379079c5f3ed3841da8a02d33a36bf0a08d720f0 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 6 Aug 2019 20:39:02 +0200 Subject: [PATCH] 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 --- lightningd/gossip_control.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index aee2b114f..ac622c401 100644 --- a/lightningd/gossip_control.c +++ b/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);