Commit graph

6 commits

Author SHA1 Message Date
Dave Collins
fc69776371 Expose a transaction store and related functions.
Several of the functions require a map of contextual transaction data to
use as a source for referenced transactions.  This commit exports the
underlying TxData type and creates a new type TxStore, which is a map of
points to the under TxData.  In addition, this commit exposes a new
function, FetchTransactionStore, which returns a transaction store
(TxStore) containing all of the transactions referenced by the passed
transaction, as well as the existing transaction if it already exists.

This paves the way for subsequent commits which will expose some of the
functions which depend on this transaction store.
2013-09-30 16:37:11 -05:00
Dave Collins
2f743b4821 Pre-allocate space for high use slices.
This commit modifies the code to choose sane defaults for the backing
arrays for slices that involve a lot of appends such block locators, hash
processing, and needed transactions.  This is an optimization to avoid
the overhead of growing the backing arrays and copying the data multiple
times in the most common case.  This also prevents a leak in Go GC which
will likely ultimatley be fixed, but the efficiecy gains alone are worth
the change.
2013-09-25 20:20:53 -05:00
Dave Collins
4ac899e26f Clear disconnected transactions.
Rather than removing disconnected transactions from the node viewpoint
transaction store, clear the entry instead.  This is needed for the
connect code to update transactions that were removed on the other side of
a chain fork.
2013-08-29 08:56:27 -05:00
Dave Collins
10a62a37a3 Update for latest btcutil, btcscript, and btcwire.
This commit updates the calls into btcutil, btcscript, and btcwire for the
latest API changes which remove the need for the protocol version for
serialization and deserialization of blocks and transactions.
2013-08-05 18:53:50 -05:00
Dave Collins
c3b330e42d Allow tx inputs to use txns earlier in same block.
It is acceptable for a transaction input in a block to reference the
output of another transaction in the same block only if the referenced
transaction comes before the transaction referencing it.
2013-07-29 15:48:52 -05:00
Dave Collins
aa5847f3cc Initial implementation. 2013-07-19 08:50:13 -05:00