Commit graph

6 commits

Author SHA1 Message Date
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
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
Steven Roose
2c0dc2d862 Small errors in documentation.
I could not resist while reading.
2013-06-01 00:09:26 +02: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
752ca5dfbb Initial implementation. 2013-05-29 10:09:26 -05:00