Commit graph

4 commits

Author SHA1 Message Date
Dave Collins
18ac5c848a Add 2014 to copyright dates. 2014-01-08 23:52:54 -06:00
Dale Rahn
992d11830c Implement a fast path for the Initial Block Download.
It is not necessary to do all of the transaction validation on
blocks if they have been confirmed to be in the block chain leading
up to the final checkpoint in a given blockschain.

This algorithm fetches block headers from the peer, then once it has
established the full blockchain connection, it requests blocks.
Any blocks before the final checkpoint pass true for fastAdd on
btcchain operation, which causes it to do less valiation on the block.
2013-12-12 07:54:48 -05:00
Dave Collins
e888372019 Optimize transaction lookups.
This commit modifies the transaction lookup code to use a set instead of a
slice (list).  This allows the lookup to automatically prevent duplicate
requests to the database.

Previously, the code simply added every referenced transaction to a list
without checking for duplicates, which led to multiple requests against
the database for the same transaction.  It also meant the request list
could grow quite large with all of the duplicates using far more memory
than required.

While the end result was accurate, operating that way is not as efficient
as only requesting unique transactions.
2013-10-10 12:23:46 -05:00
Dave Collins
32790d52d8 Add tests for HaveBlock.
This commit adds tests to ensure HaveBlock works properly with blocks on
the main chain, a side chain, orphans, and missing blocks.
2013-10-09 18:43:22 -05:00