Commit Graph

9 Commits

Author SHA1 Message Date
Dave Collins
6222b1d8cc Rework and Improve addblock utility.
The addblock utility was originally written as a quick debug tool during
initial development to populate blocks into the database.  However, now
that it has been designated as the standard way to import bootstrap.dat
(and indeed block data files in general), it was lacking a few features
such as properly checking against the chain rules and known good
checkpoints.

This commit reworks and improves the utility in several ways:

- Imported blocks are now checked against the chain rules including
  checkpoints to ensure they match the known good chain
- The utility now properly shuts down after processing all blocks
- Attempting to import orphan blocks (blocks which build off a block you
  don't yet have in the database) returns an error
- Blocks that are already known are now skipped instead of causing an
  error which means you can stop and restart the import mid-way through
  without issues or start it after you've already downloaded a
  portion of the chain
- The block height is no longer assumed to start at 0 which means input
  files that start later in the chain will work properly so long as you
  already have the chain at least up to the point of the block just before
  the first one in the input file
- Improved error handling and reporting
- How often the progress display is shown is now configurable
- Statistics about how many blocks were processed, imported, and already
  known are now displayed after the input file has been fully processed

This resolves comments made in #60.
2014-01-14 01:18:52 -06:00
Marco Peereboom
96ded50f6b Dont write pprof info in addblock.
dont write pprof info in addblock  (ok drahn); and make progress a little
more silent
2014-01-07 16:06:29 -06:00
Marco Peereboom
d00ccc0d3c Make limits into a pkg.
This is so that we can use the in other utils.

debated with davec
2014-01-07 16:06:12 -06:00
Dave Collins
c34ab6a95e Remove sqlite3 import from addblock.
The sqlite3 db backend is deprecated, so this is no longer needed.  Also,
since sqlite3 is a cgo binding it doesn't cross compile nicely.
2013-12-12 13:37:46 -06:00
Dave Collins
93c1f7d31b Update utilities to use new btclog as well. 2013-11-21 19:03:55 -06:00
Dave Collins
89eae6f590 Update utilities to use new btcutil.AppDataDir.
Closes #30.
2013-11-11 10:58:39 -06:00
David Hill
55b300b6c2 improve addblock 2013-10-10 14:05:54 -04:00
Dave Collins
fd4b63073f Go fmt new utils. 2013-10-04 10:09:15 -05:00
Dale Rahn
7659a134c9 Add new tool to rewind the database to a specific height or sha
Initial code for a block show/dump tool.

Initial code for a simple block inserter.
2013-10-04 09:33:56 -04:00