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