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 <decker.christian@gmail.com>
This commit is contained in:
parent
a121b7dbc3
commit
ba3ceb2abf
|
@ -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);
|
first_utxo = db_get_intvar(w->db, "last_processed_block", UINT32_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Never go below the start of the Lightning Network */
|
||||||
|
if (first_utxo < first_possible)
|
||||||
|
first_utxo = first_possible;
|
||||||
|
|
||||||
if (first_utxo < first_channel)
|
if (first_utxo < first_channel)
|
||||||
return first_utxo;
|
return first_utxo;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue