Commit graph

113 commits

Author SHA1 Message Date
Dale Rahn
78d4bfecd4 Remove obsolete API functions 2013-10-03 14:08:04 -04:00
David Hill
9abf071308 increase default pagesize to 4096 on sqlite 2013-10-03 10:32:19 -04:00
Dale Rahn
63f8993163 Delete testing operations from obsolete functions. 2013-10-02 18:10:00 -04:00
Dale Rahn
8d1db93c82 Remove unused interfaces. 2013-10-02 17:24:26 -04:00
Marco Peereboom
e840c8314c catch up with api changes 2013-09-26 10:15:14 -05:00
Dale Rahn
3640f6d37c Version the leveldb (and keep compatibility with pre-versioned uncompressed databases. 2013-09-25 17:23:34 -04:00
Marco Peereboom
0e98349c98 disable compression, don't use cache and limit open files 2013-09-25 17:23:33 -04:00
David Hill
18b3e86179 FetchTxAllBySha needs to return err to the caller.
ok drahn@
2013-09-23 15:39:53 -04:00
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
a2946ea14b Don't add "btcd.ldb" directory to provided path. 2013-09-13 17:32:04 -05:00
Dale Rahn
1530141ba0 This query should be performed as part of the transaction, not outside it. 2013-09-13 11:52:07 -04:00
Dale Rahn
9e27c82a23 Fix error messages (pointed out by go vet) 2013-09-13 11:49:30 -04:00
Dale Rahn
5e4c78a1b7 Fix a shadowed return parameter. 2013-09-13 10:54:45 -04:00
Dale Rahn
7d679a6228 Adjust Block height indicators properly when database is created. 2013-09-10 14:17:24 -04:00
Dave Collins
9049bcacec Update error message for zero hash change. 2013-09-10 10:47:49 -05:00
Dave Collins
d9404fe880 Correct test for zero hash versus nil on empty db. 2013-09-10 10:45:02 -05:00
Dale Rahn
adc73cbc9d quiet. 2013-09-10 11:25:13 -04:00
Dave Collins
85553133ce gofmt. 2013-09-10 10:09:44 -05:00
Dave Collins
30f2003301 Remove spurious log.Info prints. 2013-09-10 10:09:43 -05:00
Dave Collins
66d6f10d5d Fix NewestSha. 2013-09-10 10:09:42 -05:00
Dale Rahn
96f7305c29 One DB instad of many.
improved error handling

Fix testing, no point in running tests multiple times

Fix error when no blocks in database, reopen would misreport NewstSha() return
2013-09-10 10:05:26 -04:00
Dale Rahn
b66abdf6ba Initial leveldb code.
This code is still prototype at this time.
It appears to function correctly but something
consumes more memory than is considered reasonable
for the dataset comprised of the full bitcoind chain.

Not recommened for use at this time.
2013-08-22 09:34:50 -04:00
Dale Rahn
b4c6a5b8ab fmt 2013-08-22 09:32:23 -04:00
Owain G. Ainsworth
840708a3e7 Fix up some format strings to appease go vet.
Extra argument present when no format directive for it (and not needed,
either).
2013-08-06 18:00:47 +01:00
Dave Collins
519e183151 Update the insertfail test for the latest changes. 2013-08-06 11:48:23 -05:00
Dave Collins
8062889d04 Update for latest btcutil and btcwire changes.
This commit updates the calls into btcutil 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:28:17 -05:00
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
Dale Rahn
d8c3213d99 more 2013-08-03 11:09:50 -04:00
Dale Rahn
85d97d7436 block converted. 2013-08-02 18:31:21 -04:00
Dale Rahn
ead14e5a12 Testing code for FetchHeightRange() 2013-08-01 16:14:22 -04:00
Dale Rahn
b46d53c18e Test NewestSha() 2013-08-01 15:03:26 -04:00
Dale Rahn
f205ff5ac0 External API functions need to grab locks before performing internal database operations.
Untangle internal and external functions, to prevent recursive locks
2013-07-31 11:14:19 -04:00
Dave Collins
dc3a2dbac0 Correct example usage.
The variable to insert is 'genesis', not 'block'.
2013-07-29 12:41:30 -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
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
Owain G. Ainsworth
1f773006f0 fix tests building from 166a546078 2013-07-09 22:49:58 +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
Steven Roose
2c0dc2d862 Small errors in documentation.
I could not resist while reading.
2013-06-01 00:09:26 +02: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
b686bbacf5 Update and fix usage example.
This commit updates the usage example as follows:

- Add a defer db.Close since the database should be closed after the
  caller is done with it
- Correct the import path for the btcdb/sqlite3 package
- Add a db extension to the example database name
- Make the error handling and comments match the standard style
2013-05-31 13:57:18 -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