Commit graph

3431 commits

Author SHA1 Message Date
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
Dave Collins
8364392037 Remove SeedPeer option as it's not implemented. 2013-10-04 00:46:03 -05:00
Dave Collins
1db523883e Add missing format specifier in mempool.go.
Found by go vet.
2013-10-04 00:38:33 -05:00
Dave Collins
f983b0846e Add missing format specific in addrmanager.
Found by go vet.
2013-10-04 00:37:15 -05:00
Dave Collins
47c07ee5e1 Update a few comments. 2013-10-04 00:35:26 -05:00
Dave Collins
78e9b94d93 Implement transaction pool and relay.
This commit is a rather large one which implements transaction pool and
relay according to the protocol rules of the reference implementation.
It makes use of btcchain to ensure the transactions are valid for the
block chain and includes several stricter checks which determine if they
are "standard" or not before admitting them into the pool and relaying
them.

There are still a few TODOs around the more strict rules which determine
which transactions are willing to be mined, but the core checks which
are imperative (everything except the all of the "standard" checks really)
to operate as a good citizen on the bitcoin network are in place.
2013-10-03 22:31:54 -05:00
Dave Collins
3678153ae4 Allow regtest tool to be treated as a sync peer. 2013-10-03 22:31:00 -05:00
Dale Rahn
cda0b10082 Introduce an API change for btcdb
FetchTxBySha changes what it returns, it can now return a TxListReply and
and error if none are found.

FetchTxByShaList is renamed to FetchUnSpentTxByShaList to indicate that
it will (likey/eventually) only return Tx that have some unspent TxOuts.
Tx which are fully spent may not be (reliably) looked up using this API.
2013-10-03 16:51:34 -04:00
Dale Rahn
d58fb25d98 Update btcchain for btcdb API change. 2013-10-03 16:44:07 -04:00
Owain G. Ainsworth
182c4d9ee6 Remove peers from duplicate map *before* we restart sync.
Just in case this ordering causes problems.
2013-10-03 20:13:56 +01:00