Branch: refs/heads/master
  Home:   https://github.com/conformal/btcwallet
  Commit: c97e0d5fc67487140d2241237584d42ad9b0c6e8
      
https://github.com/conformal/btcwallet/commit/c97e0d5fc67487140d2241237584d42ad9b0c6e8
  Author: Josh Rickmar <[email protected]>
  Date:   2013-12-09 (Mon, 09 Dec 2013)

  Changed paths:
    M account.go
    M accountstore.go
    M sockets.go
    M wallet/wallet.go

  Log Message:
  -----------
  Detect reorgs after btcd disconnect/reconnect.

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.


Reply via email to