Add parameters used by btcd.

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.
This commit is contained in:
Josh Rickmar 2014-05-22 23:13:44 -05:00
parent 55ef07ca61
commit 536c1e3c29

View File

@ -41,6 +41,10 @@ type Params struct {
PowLimit *big.Int
PowLimitBits uint32
SubsidyHalvingInterval int32
ResetMinDifficulty bool
// Mempool parameters
RelayNonStdTxs bool
// Encoding magics
PubKeyHashAddrID byte // First byte of a P2PKH address
@ -59,6 +63,10 @@ var MainNetParams = Params{
PowLimit: mainPowLimit,
PowLimitBits: 0x1d00ffff,
SubsidyHalvingInterval: 210000,
ResetMinDifficulty: false,
// Mempool parameters
RelayNonStdTxs: false,
// Encoding magics
PubKeyHashAddrID: 0x00,
@ -79,6 +87,10 @@ var RegressionNetParams = Params{
PowLimit: regressionPowLimit,
PowLimitBits: 0x207fffff,
SubsidyHalvingInterval: 150,
ResetMinDifficulty: true,
// Mempool parameters
RelayNonStdTxs: true,
// Encoding magics
PubKeyHashAddrID: 0x6f,
@ -90,7 +102,7 @@ var RegressionNetParams = Params{
// (version 3). Not to be confused with the regression test network, this
// network is sometimes simply called "testnet".
var TestNet3Params = Params{
Name: "testnet",
Name: "testnet3",
Net: btcwire.TestNet3,
// Chain parameters
@ -99,6 +111,10 @@ var TestNet3Params = Params{
PowLimit: testNet3PowLimit,
PowLimitBits: 0x1d00ffff,
SubsidyHalvingInterval: 210000,
ResetMinDifficulty: true,
// Mempool parameters
RelayNonStdTxs: true,
// Encoding magics
PubKeyHashAddrID: 0x6f,