Commit graph

3455 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
Dave Collins
d8ec5bd33c Prepare for release 0.5.0. 2014-01-13 17:47:21 -06:00
Dave Collins
8b479794ab Add 0.5.0 deps to deps.txt. 2014-01-13 17:45:15 -06:00
Josh Rickmar
15f2ce4abd Fix a couple incorrect comments. 2014-01-13 17:16:58 -05:00
Dave Collins
c99a227df2 Fix a couple of comment typos. 2014-01-10 22:32:05 -06:00
Josh Rickmar
427fb3cd94 gencerts: Print error lowercased for consistency. 2014-01-10 17:57:14 -05:00
Josh Rickmar
aec17304a0 Add standalone gencerts utility to create RPC TLS certificates. 2014-01-10 16:59:54 -05:00
Josh Rickmar
035f8f82b7 Switch to btcutil for certificate generation. 2014-01-10 15:41:57 -05:00
David Hill
3a59e4d064 Set the Connection header to close 2014-01-10 10:57:05 -05:00
Dave Collins
dacf9d77c5 Comment the onion/proxy dial/lookup configuration. 2014-01-10 01:52:15 -06:00
Dave Collins
4f8c2a3aaf Move missing config file warn just before return.
The warning about a missing config file should only be shown after all
other configuration has succeeded so it's not shown when there are invalid
options specified.  Also add a comment about it where its intended
placement is for the future.
2014-01-10 01:34:50 -06:00
Dave Collins
d33e9b4165 Unexport and comment btcDial and btcLookup func.
These functions are at the package level and only apply within btcd, so
unexport them to be consistent.
2014-01-10 01:31:20 -06:00
Marco Peereboom
6578e7345f catch up to new goleveldb 2014-01-09 13:11:37 -06:00
Josh Rickmar
cd3084afcd Rework the btcwallet connection.
This changes the protocol between btcd and btcwallet to follow
JSON-RPC specifications sending notifications as requests with an
empty ID.

The notification request context handling has been greatly cleaned up
now that IDs no longer need to be saved when sending notifications.
2014-01-09 14:03:00 -05:00
Dale Rahn
a5cc3196b4 Clear fetchheaders fields if in that mode and syncpeer detaches. 2014-01-09 13:22:42 -05:00
Dave Collins
f93c8a4af1 Don't display btcctl getconnectioncount as float. 2014-01-09 12:17:26 -06:00
Dave Collins
af0750dd76 Don't display getblockccount from btcctl as float. 2014-01-09 12:15:46 -06:00
Josh Rickmar
05a0ba18b4 Kill GetBalancesCmd. 2014-01-09 13:14:53 -05:00
Dave Collins
b3f63cf35e Fix typo in fetch blocks log message. 2014-01-09 12:13:14 -06:00
Dave Collins
28f485a1d1 Fix a couple of style nits. 2014-01-09 11:36:50 -06:00
Josh Rickmar
33890d49e9 Fix a typo. 2014-01-09 11:51:51 -05:00
Marco Peereboom
371dfdd76a Kill last sqlite3 bits.
This was driving me insane when building with -a -v and it slowed down
the process dramatically.

ok davec
2014-01-09 10:26:17 -06:00
Dave Collins
6b18796af7 Add 2014 to copyright dates. 2014-01-08 23:54:52 -06:00
Dave Collins
18ac5c848a Add 2014 to copyright dates. 2014-01-08 23:52:54 -06:00
Dave Collins
58cab817f0 Add 2014 to copyright dates. 2014-01-08 23:51:37 -06:00
Dave Collins
bf90ed2142 Add 2014 to copyright dates. 2014-01-08 23:49:06 -06:00
Dave Collins
565f11409c Add 2014 to copyright dates. 2014-01-08 23:47:47 -06:00
Dave Collins
6c7f45fdb7 Add 2014 to copyright dates. 2014-01-08 23:44:08 -06:00
Josh Rickmar
d493181886 Add TxSpentNtfn to notify wallets spent outpoints. 2014-01-08 21:29:19 -05:00
Dave Collins
3946d84887 Make use of the new size hint functions in btcwire.
This commit changes a couple of sections which deal with large lists of
inventory vectors to use the new size hint functions recently added to
btcwire.  This allows a bit more efficiency since the size of the list is
known up front and we can therefore avoid dynamically growing the backing
array several times.  This also helps avoid a Go bug that leaks memory on
appends and GC churn.
2014-01-08 17:46:59 -06:00
Dave Collins
2458841855 Add tests for new size hint functions.
This brings the test coverage back up to 100%.
2014-01-08 17:43:18 -06:00
Dave Collins
497aac6d4a Add new funcs to allow size hints on getdata/inv.
This commit adds two new functions named NewMsgGetDataSizeHint and
NewMsgInvSizeHint.  These are intended to allow callers which know in
advance how large the inventory lists will grow the ability to provides
that information when creating the message.  This in turn provides a
mechanism to avoid the need to perform several grow operations of the
backing array when adding large number of inventory vectors.
2014-01-08 17:21:51 -06:00
Josh Rickmar
6e3f9e451b Rename RescanResultNtfn to ProcessedTxNtfn.
This notification should be generic enough to be used by both rescan
and normal block processing code, so give it a generic name too.
2014-01-08 15:23:59 -05:00
Dave Collins
462bc5a031 Update for recent btcscript API changes.
This commit changes all code which deals with extracting addresses from
scripts to use the btcscript API ExtractPkScriptAddrs which in turn makes
use of the new btcutil.Address interface.

This provides much cleaner code for dealing with arbitrary script
destinations which is extensible without having to churn the APIs if new
destination types are added.
2014-01-08 11:22:29 -06:00
Josh Rickmar
9ea77c00f2 Add RescanResultNtfn to notify rescan results. 2014-01-08 11:28:38 -05:00
John C. Vernaleo
6747e36f51 Slight increase in test coverage. 2014-01-08 10:31:54 -05:00
Josh Rickmar
c06d4007fe Fix build for new btcjson.Cmd interface. 2014-01-08 09:44:11 -05:00
John C. Vernaleo
d1efe0c109 Add SetId() to Cmd along with tests. 2014-01-08 09:36:43 -05:00
Dave Collins
e50681264b Add 100% test coverage for ExtractPkScriptAddrs. 2014-01-07 18:09:48 -06:00
Dave Collins
6c8003b064 Refactor and improve address extraction code.
This commit significantly changes the address extraction code.  The
original code was written before some of the other newer code was written
and as a result essentially duplicated some of the logic for handling
standard scripts which is used elsewhere in the package.

The following is a summary of what has changed:

- CalcPkScriptAddrHashes, ScriptToAddrHash, and ScriptToAddrHashes have
  been replaced by ExtractPkScriptAddresses
- The ScriptType type has been removed in favor of the existing
  ScriptClass type
- The new function returns a slice of btcutil.Addresses instead of raw
  hashes that the caller then needs to figure out what to do with to
  convert them to proper addressses
- The new function makes use of the existing ScriptClass instead of an
  nearly duplicate ScriptType
- The new function hooks into the existing infrastructure for parsing
  scripts and identifying scripts of standard forms
- The new function only works with pkscripts to match the behavior of the
  reference implementation - do note that the redeeming script from a p2sh
  script is still considered a pkscript
- The logic combines extraction for all script types instead of using a
  separate function for multi-signature transactions
- The new function ignores addresses which are invalid for some reason
  such as invalid public keys
2014-01-07 17:48:18 -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
Owain G. Ainsworth
dd7c910e86 Enable use of a different proxy for .onion addresses.
This implements --onion (and --onionuser/--onionpass) that enable a
different proxy to be used to connect to .onion addresses. If no main
proxy is supplied then no proxy will be used for non-onion addresses.

Additionally we add --noonion that blocks connection attempts to .onion
addresses entirely (and avoids using tor for proxy dns lookups).

the --tor option has been supersceded and thus removed.

Closes #47
2014-01-07 19:18:09 +00:00
John C. Vernaleo
ee378dc0c0 Add additional tests for listreceivedbyaccount.
Fix bug caught by tests.
2014-01-07 13:49:45 -05:00
John C. Vernaleo
cea1120a0a Add tests for listreceivebyaddress.
Fix bug with minconf type caught by test (thanks oga).
2014-01-07 13:44:12 -05:00
Dave Collins
126991b60b Make opcode disasm names match reference impl.
This commit modifies the names of opcdoes shown in the oneline script
disassembly to match the reference implementation.  In particular
OP_1NEGATE, and OP_0 through OP_16 are changed to the raw numbers
they represent when doing oneline disassembly.  When doing full
disassembly, the full opcode names are still shown.

ok @owainga.
2014-01-07 12:07:54 -06:00
Dave Collins
34657d43d9 Add the useragent to the new valid peer message.
This commit modifies the new valid peer message to display the useragent.
Previously this information was only available by setting the PEER
subsystem debuglevel to debug or lower.

This was prompted by #64.
2014-01-07 11:16:15 -06:00
David Hill
47c92c0e62 fix typo 2014-01-06 15:57:37 -05:00
Dave Collins
e2f14e2cfa Fix comment typo. 2014-01-06 12:14:43 -06:00
Josh Rickmar
8b5277e73a Add sendrawtransaction support to btcctl. 2014-01-06 11:50:02 -05:00