Commit graph

10 commits

Author SHA1 Message Date
Dale Rahn
3b743e4cfc Cleanup after insert failure, do not leave inconsistant db.
Fix error returns in InsertBlock and FetchBlockBySha

Give up on return by name in InsertBlock() and return explicit
err one location in FetchBlockBySha to return proper error value
2013-08-03 11:15:42 -04:00
Dave Collins
25684a2ccb Don't add a genesis block by default.
This commit modifies the way initial database creation is handled.

Previously, the genesis for the main chain was inserted automatically upon
creation of the database.  However, that approach caused an issue since
other networks such as the test network don't use the same genesis block
as the main network.

The new approach introduced by this commit is to leave it up to the caller
to insert the desired genesis block.  In order to support this, the
InsertBlock function has been modified to allow the first (and only the
first) block to be inserted without having an existing parent.  Also, the
NewestSha function has been modified to return a zero hash, -1 for the
height, and no error when the database does not yet have any blocks.  This
allows the caller to determine the difference between no blocks and only
the genesis block (in which case the return values would be the genesis
hash and 0 for the height).
2013-07-29 11:48:10 -05:00
Dave Collins
584481280c Print actual hash on a couple of log warnings.
The blocksha variable is already a pointer.
2013-07-29 10:57:03 -05:00
Dale Rahn
92651c6d13 Fix spent computation on a multiple of 8 txout tx. 2013-07-19 15:49:02 -05:00
Dale Rahn
bee05db603 Exunge debug code. 2013-07-18 18:19:57 -04:00
Dale Rahn
66731c1a1e Implement TxOut Spend tracking.
Return spent data in TxListReply.

Unspend coins when blocks are removed during DropAfterBlock.
2013-07-18 18:11:37 -04:00
Owain G. Ainsworth
a7a9023bc1 Add ExistsTxSha to db interface.
This function may be used to check for existance of a tx sha without having to
fetch the data from the db.
2013-07-10 00:11:02 +01:00
Dave Collins
166a546078 Modify DropAfterBlockBySha to accept a pointer.
Since all other functions take pointers, this makes the interface more
consistent.
2013-06-25 10:15:58 -05:00
Owain G. Ainsworth
a2e3fd92b0 Only try to drop the uniquetx index if it exists.
Solves a corner case after a crash.
2013-05-29 17:54:46 +01:00
Dave Collins
752ca5dfbb Initial implementation. 2013-05-29 10:09:26 -05:00