This commit introduces an HDPrivateKeyID and HDPublicKeyID field to the
params struct which are used by hierarchical deterministic extended keys
as defined by BIP0032.
In addition, a new function named HDPrivateKeyToPublicKeyID has been added
to allow the caller to get the associated public key ID given a private
key ID.
The tests have also been updated to maintain 100% test coverage.
ok @jrick
While here, fix a bug found through testing. Register will now return
ErrDuplicateNet if the caller attempts to register any of the standard
network parameters provided by this package.
ok @davecgh
This value matches testnet and mainnet and makes more sense because it
allows way more coins to be generated which is useful during simulation
testing.
NOTE: this will invalidate existing simnet chains, but since they
are only intended to be short lived for the duration of a simulation test,
this is a non-issue.
The genesis block for each network is a parameter for the network. As
such, it makes more sense to define them in this package instead of in the
wire protocol package.
ok @jrick
The examples uses a btcutil API that was recently updated from passing
btcwire.BitcoinNet to *btcnet.Params. This change updates the btcutil
call in the examples, as well as modifying the example in the README
to match that in doc.go (where errors were handled slightly
differently).
The ParamsForNet function was removed, so likewise this change removes
ErrUnknownNet error that it used to return.
As network registration is now necessary for correct handling of
alternate network encoding magics, and therefore the ErrDuplicateNet
error returned by Register is here to stay, kill the comment about the
error being removed later.
This commit adds more chain-related fields to the parameters as a part of
converting btcchain to work with btcnet parameters instead of coding the
network-specific knowledge into the package itself.
It also moves the checkpoints from btcchain since checkpoints are a
network parameter and make more sense here.
ok @jrick
This change adds two parameters to the Params struct which are used by
btcd to alter behavior based on the active network, rather than
hardcoding checks for a particular network.
The first, ResetMinDifficulty, specifies whether the target difficulty
can change between the retarget intervals.
The second, RelayNonStdTxs, specifies whether standard transaction
checks should not be performed when accepting mempool transactions.
The zero values (false) for both of these bools are the correct
parameter values for mainnet.
While here, rename the test network version 3 to "testnet3", as both
btcd and btcwallet will include additional handling to rename this to
"testnet" for directory names, and a switch to "testnet3" is planned
in the future.