Commit graph

15 commits

Author SHA1 Message Date
Dave Collins
62e38e29e5 Add a new function named SupportedDBs.
This function allows the callers to programatically ascertain which
database backend drivers are registered and therefore supported.
2013-09-15 15:18:46 -05: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
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
Dave Collins
10d981974c Add documentation for functions and types. 2013-05-31 15:19:34 -05:00
Dave Collins
8d8fdf4fc1 Add documentation for Db interface. 2013-05-31 15:12:42 -05:00
Dave Collins
5882b3c79a Change Tx to transaction in user facing error. 2013-05-31 14:07:48 -05:00
Dave Collins
64568826f1 Correct spelling of nonexistent. 2013-05-31 14:04:14 -05:00
Dave Collins
fac055c24e Add comments to clarify interface function caching.
This commit attempts to clarify which functions in the Db interface may be
returning cached data that the InvalidateCache, InvalidateBlockCache, and
InvalidateTxCache functions are used to clear.
2013-05-31 13:40:38 -05:00
Dave Collins
7416e9a71d Rename funcs and variables for Idx to Height.
The Db interface is intended to work with block heights as opposed to
specific database ids which may or may not be the same as the block
height.  This commits changes the function names to make that distinction
a little more clear.
2013-05-30 17:35:59 -05:00
Dave Collins
bea4ccbeef Finish incomplete comment. 2013-05-30 17:21:15 -05:00
Dave Collins
684582cde6 Cleanup the Db interface comments a bit. 2013-05-30 17:18:43 -05:00
Dave Collins
9bf708595d Add InsertBlockData needed by tests to interface.
The function is being added back in since the tests rely on it, but it is
marked as DEPRECATED since it really should not be a part of the public
generic db interface.
2013-05-29 15:30:26 -05:00
Dave Collins
752ca5dfbb Initial implementation. 2013-05-29 10:09:26 -05:00