Commit graph

2890 commits

Author SHA1 Message Date
Owain G. Ainsworth
7ff3d5f871 Handle sign extended numbers in parsing variable length opcodes. 2013-10-08 23:24:19 +01:00
Dave Collins
f4dac3abf0 Update to use latest btcwire invtype constants. 2013-10-08 15:55:07 -05:00
Dave Collins
5c8fddf4b4 Add deprecated comments to legacy InvVect_* consts.
This makes it a little more obvious in the documentation that they are
deprecated.
2013-10-08 15:51:34 -05:00
Dave Collins
93d86305a2 Deprecate InvVect_* constants in favor of InvType*.
This commit changes the InvVect_* constants, which are not standard Go
style, to the InvType*. In order to preserve backwards compatibility, it
also adds a legacy.go file which maps the old public constant names to the
new ones.

Closes #1.
2013-10-08 15:44:48 -05:00
Dave Collins
c8160a57aa Switch to leveldb by default.
Also, add a warning if multiple block databases are detected.
2013-10-08 15:00:34 -05:00
Dave Collins
67838afb20 Go fmt and comments. 2013-10-08 13:34:04 -05:00
Dave Collins
2ad0d34d27 Add updating instruction to README.md. 2013-10-08 13:31:01 -05:00
Dave Collins
b911e7e455 Replace HaveInventory with HaveBlock.
The original thought was that chain would also house the transaction
memory pool, but that ultimately was decided against.  As a result,
it only makes sense to query chain for blocks rather than generic
inventory.
2013-10-08 12:32:15 -05:00
Josh Rickmar
8a743c344a Update all comments and test coverage with new func name 2013-10-08 13:12:24 -04:00
Josh Rickmar
83a19b239d Replace ScriptToAddress with ScriptToAddrHash to return an address hash. 2013-10-08 13:01:51 -04:00
Josh Rickmar
21a2158eca Fixes for btcutil and btcscript api changes 2013-10-08 12:37:06 -04:00
Dave Collins
697532bd68 Add handling for mempool command. 2013-10-08 00:04:51 -05:00
Dave Collins
d4e006e515 Update findcheckpoint to support testnet and dbtype. 2013-10-07 20:53:25 -05:00
Dave Collins
1d2c48555b Misc cleanup. 2013-10-07 19:24:44 -05:00
Dave Collins
19d28f90e6 Log transactions rejected from mempool as debug.
Most users won't care if a freestanding transaction is rejected from due
to a rule violation, but the information should still be available to
debug.
2013-10-07 18:45:53 -05:00
Owain G. Ainsworth
52a1488eaf bitcoind only fails on invalid (undefined) opcodes when they are executed.
So add entries for them that disassemble and parse ok, but will fail
when executed with the appropriate error. Add a full suite of tests to confirm
that this happens.

Found by a strange transaction in testnet.
2013-10-08 00:16:23 +01:00
Dave Collins
849c830cf8 Move DNS seed consts to same file that uses them.
Also, use multi constant define for the result.
2013-10-07 17:58:16 -05:00
Dave Collins
c03f2b757b Move initial DNS seeding to own func. 2013-10-07 17:38:45 -05:00
Dave Collins
4b728df738 Update some comments and code consistency. 2013-10-07 17:27:59 -05:00
Dave Collins
ca5c734e05 Add warning if there are no sync peers.
This is to help track down stalls that are being seen.
2013-10-07 17:09:33 -05:00
Marco Peereboom
8e7d900201 Up some limits on !windows.
This is needed on OSX and possibly others.

ok davec
2013-10-07 16:44:46 -05:00
Dave Collins
995d8da491 Handle another removal case missed in prev commit.
Also, the loops which only remove a single element and break or return
don't need the extra logic for iteration since they don't continue
iteration after removal.
2013-10-07 10:10:22 -05:00
Dave Collins
219a6131f4 Correct all list/container loops that remove items.
It is not safe to remove an item from a container/list while iterating the
list without first saving the next pointer since removing the item nils
the internal list element's next pointer.
2013-10-07 09:06:29 -05:00
John C. Vernaleo
ff2c88e3b4 Fix an import path. 2013-10-07 10:06:15 -04:00
Dave Collins
95ecbadb8e Ensure readVarInt handles short buf on first byte.
It is technically possible for the Read method on a reader to return zero
bytes read with a nil error even though that behavior is "discouraged" by
the interface documenation.  This commit switches the read of the first
byte to use io.ReadFull which will always error in this case.
2013-10-06 22:06:34 -05:00
Dave Collins
0b334bc841 Correct reading of serialized height in coinbase.
This commit corrects the reading of the serialized height in coinbase
transactions for block height of version 2 or greater.  On mainnet, the
serialized height is always 3 bytes and will continue to be so for
something like  another ~159 years, so there was no issue with mainnet.
However on testnet, there are some version 2 blocks which are low enough
in the chain to only take 2 bytes to serialize.

In addition, this commit adds a full tests for the relavant function
including negative tests and variable length serialized lengths for block
heights.

Closes #1.
2013-10-06 14:27:53 -05:00
Dave Collins
bce548cb99 Update reorg test to insert genesis block first.
btcdb was changed a while back to not insert the genesis block by default.
This commit modifies the reorg test to insert it as required so not all
blocks are orphans.
2013-10-06 14:23:09 -05:00
Dave Collins
8e12234c56 Fix a couple of comments. 2013-10-05 17:40:54 -05:00
Dave Collins
c28c6e7636 Correct blog link in README.md. 2013-10-05 02:51:12 -05:00
Dave Collins
19a238825b Fix typo in README.md 2013-10-05 02:48:03 -05:00
Dave Collins
4864298884 Update README. 2013-10-04 23:02:00 -05:00
Dave Collins
9197342df0 Add deps.txt to track all deps used per release. 2013-10-04 16:03:50 -05:00
Dave Collins
168ff0e129 Bump version to 0.3.0. 2013-10-04 14:29:37 -05:00
Dave Collins
bba9fed133 Accepted transactions should log at debug level. 2013-10-04 14:16:57 -05:00
Dave Collins
4151416b16 Change processing block log message to trace.
When running debug level logging, the only thing that really matters is
whether the block was accepted or not.
2013-10-04 13:41:24 -05:00
Dave Collins
efb54784c8 Log rejected blocks and transactions as info.
Rather than logging these as warnings which implies something is wrong
that might require user action, log them as info.
2013-10-04 13:35:28 -05:00
Dave Collins
223d146a10 Improve logging of rejected transactions.
Rather than showing all errors from ProcessTransaction as a failure, check
if the error is a TxRuleError meaning the transaction was rejected as
opposed to something actually going wrong and log it accordingly.
2013-10-04 13:33:54 -05:00
Dave Collins
83ac359c51 Convert transaction pool errors to their own type.
This allows the caller to distinguish if the error is because of a rule
violation or due to something actually going wrong.
2013-10-04 13:30:50 -05:00
Dave Collins
78b555fcf9 Improve logging of rejected blocks.
Rather than showing all errors from ProcessBlock as a failure, check if
the error is a RuleError meaning the block was rejected as opposed to
something actually going wrong and log it accordingly.
2013-10-04 13:13:16 -05:00
John C. Vernaleo
5444d262b8 Fix for signrawtransaction.
Add sendrawtransaction to list of commands we know the return type
for.
2013-10-04 13:18:49 -04:00
Dave Collins
9841403c58 Correct comment on fetchTxListMain. 2013-10-04 12:11:58 -05:00
Dave Collins
e4d3f25991 Update imports for goleveldb to Conformal fork. 2013-10-04 11:41:00 -05:00
Dave Collins
c3a17de326 Comment Connected function in peer.
While here, also rearrange the functions slightly to logically group them.
2013-10-04 10:45:21 -05:00
Dave Collins
689c699bc5 Add a new findcheckpoint utility.
This utility is useful to programatically identify checkpoint candidates
which a developer can then do a more in-depth analysis on to choose an
appropriate checkpoint.
2013-10-04 10:12:24 -05:00
Dave Collins
905715e830 Update LICENSE to ISC on new utils. 2013-10-04 10:11:38 -05:00
Dave Collins
fd4b63073f Go fmt new utils. 2013-10-04 10:09:15 -05:00
Owain G. Ainsworth
96b92552b9 Can't use Connected() in Disconnect since it just set disconnected.
Use p.connected directly. This restores the correct disconnection of peers when
we go over the limit. Found by dhill, fix by me.
2013-10-04 15:05:31 +01: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
Dale Rahn
a10da1ed6c Update btcd for btcdb API change.
Rearrange code to pull out last tx as was previously expected.
2013-10-04 09:23:48 -04:00
Dave Collins
6ff9d152ca Update the sample config file.
This commit adds a few more available options to the sample config file
and clarifies a few things.
2013-10-04 01:38:41 -05:00