c97e0d5fc6
This change saves (at most) the last 20 block hashes to disk. Upon btcd connect, in the handshake, btcwallet checks whether btcd's best chain still contains these blocks, starting from the most recently added block and continuing until the earliest saved. If any blocks are missing, Tx history and UTXOs from any blocks no longer in the chain are removed, and a rescan is started from after the best block still in the main chain. If all previous block hashes are exhausted (either due to a large reorg, or because not enough blocks have been seen), a full rescan is triggered (full meaning from the earliest block that matters to this wallet) since the last synced up to point is no longer available. The previous 20 seen block hashes are saved to the wallet file, which required bumping the file version. Older wallets written with lesser versions will use the previous reading function, making this change backwards compatible. |
||
---|---|---|
.. | ||
wallet.go | ||
wallet_test.go |