From ba3ceb2abff2bec91a9842c2e41b6762ddc235aa Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sun, 8 Apr 2018 12:26:08 +0200 Subject: [PATCH] wallet: Lowerbound the rescan by going at most back to LNs origin Repeated crashes could result in the `last_processed_block` variable being pushed further and further into the past (in some cases going as far back as scanning blocks from 2012...). This is a stop-gap solution that just lower bounds the value to what is the first possible block we might be interested in LN, until we have the 0-rescan fix I'm working on. Signed-off-by: Christian Decker --- wallet/wallet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wallet/wallet.c b/wallet/wallet.c index a66324819..7bdc16fe9 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -826,6 +826,10 @@ u32 wallet_first_blocknum(struct wallet *w, u32 first_possible) first_utxo = db_get_intvar(w->db, "last_processed_block", UINT32_MAX); #endif + /* Never go below the start of the Lightning Network */ + if (first_utxo < first_possible) + first_utxo = first_possible; + if (first_utxo < first_channel) return first_utxo; else