Branch: refs/heads/master
  Home:   https://github.com/conformal/btcwallet
  Commit: 9153a342e4cefacb1800fad1c84cb744eeb00858
      
https://github.com/conformal/btcwallet/commit/9153a342e4cefacb1800fad1c84cb744eeb00858
  Author: Josh Rickmar <[email protected]>
  Date:   2014-06-17 (Tue, 17 Jun 2014)

  Changed paths:
    M txstore/serialization.go
    M txstore/tx.go

  Log Message:
  -----------
  Improve txstore unspent output bookkeeping.

This change "reverses" the mapping used by the transaction store to
reference and lookup unspent credits.  Rather than mapping slice
indexes of a block, and then another block map for slice indexes of
transactions with unspent credits, and requiring a lookup through each
credit for whether it is spent or unspent, keep a simple map of
outpoints to a lookup key to find the transaction in a block.

This has a positive effect on performance when searching for previous
transaction outputs that have been spent by a newly-inserted
transaction.  Rather than iterating through every block with an
unspent credit, and then every transaction with unspent credits, a
simple map lookup can be done to check whether a transaction input's
previous outpoint is marked as unspent by wallet, and then access the
transaction record itself by the lookup key.  While transactions
created by wallet with the sendfrom/many RPCs may mark debits with the
previous credits already known, the previous outputs may still not be
known if a debiting transaction was added by rescan, or notified as a
result of a create+sendrawtransaction.


Reply via email to