Branch: refs/heads/master
Home: https://github.com/conformal/btcwallet
Commit: 2e76bcd1592957e93281eb1d34beabc1d2ef60e2
https://github.com/conformal/btcwallet/commit/2e76bcd1592957e93281eb1d34beabc1d2ef60e2
Author: Josh Rickmar <[email protected]>
Date: 2014-02-28 (Fri, 28 Feb 2014)
Changed paths:
M acctmgr.go
M cmd.go
M ntfns.go
M rpcclient.go
M rpcserver.go
M tx/tx.go
M tx/tx_test.go
Log Message:
-----------
Handle out-of-order notifications from btcd.
Notifications ariving from btcd were being reordered (each handled by
its own goroutine, rather then being always sent in the order they
originated). This was breaking the new transaction store by inserting
transaction records in an 'impossible' manner, that is, inserting txs
without block info after the store already held records of the same tx
with block info, without first performing a rollback.
This is handled by the transaction store insert methods by checking
for identical transactions (double spends with the same tx sha), but
where the block heights mismatch and the new record does not have a
block set. The error is returned all the way up to the goroutine
running each rpc request/notification handler, and if hit, the btcd
connection is closed and all accounts are reopened from disk. This is
not optimal, but it allows us to use the connect logic to correctly
catch us up to the best chain with the last good state of all accounts
while only rescanning a few blocks.
Fixes #72.