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. |
||
---|---|---|
.. | ||
doc.go | ||
fixedIO_test.go | ||
json.go | ||
serialization.go | ||
tx.go | ||
tx_test.go |