Commit graph

10 commits

Author SHA1 Message Date
Dave Collins
6e0aab52df Improve the RuleError type to include error codes.
This commit changes the RuleError type to a struct which consists of an
error code and human-readable description.

From a usage perspective, existing code should not break since type
asserting an error to a RuleError still works in the same manner.  The
difference is the caller can now take that type asserted RuleError and
access the .ErrorCode field on it to programmatically identify the
specific rule that was violated.

ok @jrick
2014-06-24 19:14:24 -05:00
Dave Collins
4579cfb71b Refactor several network-specific params to btcnet.
This commit refactors the code to make use of the btcnet package for
network-specific parameters instead of switching on the specific network.

For example, the percentage of the network that needs to run version 2
blocks is different between testnet and mainnet.  Previously the code was
using a switch to choose these values.  With this refactor, those
parameters are part of the network parameters provided when creating a new
chain instance.

Another example is checkpoints, which have been moved to btcnet so they
can be specified by the caller instead of hard coded into this package.
As a result, the checkpoints for the standard networks are now specified
in the btcnet package.

This makes it easier to add new networks such as a testnet4 should it
become needed.  It also allows callers to define their own custom network
parameters without having to modify the code of the package to add new
switch cases for the custom network.
2014-05-27 10:11:55 -05:00
Dave Collins
03394d6309 Bring README.md and doc.go examples up to date.
Since sqlite is now deprecated, update the examples to use levelb.  Also,
add false to the ProcessBlock calls for the fastAdd parameter.
2014-01-17 00:48:32 -06:00
Dave Collins
18ac5c848a Add 2014 to copyright dates. 2014-01-08 23:52:54 -06:00
Dale Rahn
992d11830c Implement a fast path for the Initial Block Download.
It is not necessary to do all of the transaction validation on
blocks if they have been confirmed to be in the block chain leading
up to the final checkpoint in a given blockschain.

This algorithm fetches block headers from the peer, then once it has
established the full blockchain connection, it requests blocks.
Any blocks before the final checkpoint pass true for fastAdd on
btcchain operation, which causes it to do less valiation on the block.
2013-12-12 07:54:48 -05:00
Dave Collins
10a62a37a3 Update for latest btcutil, btcscript, and btcwire.
This commit updates the calls into btcutil, btcscript, 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:53:50 -05:00
Dave Collins
716075d0d0 Remove tesnet specific rules unsupported blurb.
The testnet specific rules have been supported since commit
9787f46f6a.
2013-08-01 17:10:59 -05:00
Dave Collins
e82c97be3b Update examples for recent btcdb changes.
Since creating a new database with btcdb no longer automatically inserts
the main network genesis block, update the examples accordingly.
2013-07-29 12:35:01 -05:00
Dave Collins
d6d2b15901 Clarify BIP0034 is supported in package doco. 2013-07-20 02:39:07 -05:00
Dave Collins
aa5847f3cc Initial implementation. 2013-07-19 08:50:13 -05:00