Rollback transactions past the last saved recent block.
If a long reorganize occurs farther back than the last saved recent block hash (currently max 20 are saved) a full rescan is triggered since there is no guarantee the previous blocks weren't also removed in the reorg. In this case, the address manager was set unsynced, but transaction history was not rolled back as well. This commit corrects this by unconfirming all transactions but those in the genesis block.
This commit is contained in:
parent
47ca1ca6e5
commit
edde89cd4c
1 changed files with 5 additions and 0 deletions
|
@ -104,6 +104,11 @@ func (w *Wallet) disconnectBlock(bs waddrmgr.BlockStamp) error {
|
|||
// earliest blockstamp the addresses in the manager are
|
||||
// known to have been created.
|
||||
w.Manager.SetSyncedTo(nil)
|
||||
// Rollback everything but the genesis block.
|
||||
err := w.TxStore.Rollback(1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
w.notifyDisconnectedBlock(bs)
|
||||
|
|
Loading…
Reference in a new issue