mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-07 14:46:44 +00:00
[NOD-360] Renamed TestNet3 to TestNet. (#426)
This commit is contained in:
parent
d99af7424c
commit
13cf1f7715
4
CHANGES
4
CHANGES
@ -513,7 +513,7 @@ Changes in 0.8.0-beta (Sun May 25 2014)
|
|||||||
- Reduce max bytes allowed for a standard nulldata transaction to 40 for
|
- Reduce max bytes allowed for a standard nulldata transaction to 40 for
|
||||||
compatibility with the reference client
|
compatibility with the reference client
|
||||||
- Introduce a new btcnet package which houses all of the network params
|
- Introduce a new btcnet package which houses all of the network params
|
||||||
for each network (mainnet, testnet3, regtest) to ultimately enable
|
for each network (mainnet, testnet, regtest) to ultimately enable
|
||||||
easier addition and tweaking of networks without needing to change
|
easier addition and tweaking of networks without needing to change
|
||||||
several packages
|
several packages
|
||||||
- Fix several script discrepancies found by reference client test data
|
- Fix several script discrepancies found by reference client test data
|
||||||
@ -530,7 +530,7 @@ Changes in 0.8.0-beta (Sun May 25 2014)
|
|||||||
- Provide options to control block template creation settings
|
- Provide options to control block template creation settings
|
||||||
- Support the getwork RPC
|
- Support the getwork RPC
|
||||||
- Allow address identifiers to apply to more than one network since both
|
- Allow address identifiers to apply to more than one network since both
|
||||||
testnet3 and the regression test network unfortunately use the same
|
testnet and the regression test network unfortunately use the same
|
||||||
identifier
|
identifier
|
||||||
- RPC changes:
|
- RPC changes:
|
||||||
- Set the content type for HTTP POST RPC connections to application/json
|
- Set the content type for HTTP POST RPC connections to application/json
|
||||||
|
@ -110,7 +110,7 @@ func resolveNetwork(cfg *Config) error {
|
|||||||
activeNetParams = dagconfig.MainNetParams
|
activeNetParams = dagconfig.MainNetParams
|
||||||
switch {
|
switch {
|
||||||
case cfg.TestNet:
|
case cfg.TestNet:
|
||||||
activeNetParams = dagconfig.TestNet3Params
|
activeNetParams = dagconfig.TestNetParams
|
||||||
case cfg.SimNet:
|
case cfg.SimNet:
|
||||||
activeNetParams = dagconfig.SimNetParams
|
activeNetParams = dagconfig.SimNetParams
|
||||||
case cfg.DevNet:
|
case cfg.DevNet:
|
||||||
|
@ -111,7 +111,7 @@ var (
|
|||||||
// allow them to change out from under the tests potentially invalidating them.
|
// allow them to change out from under the tests potentially invalidating them.
|
||||||
var regressionNetParams = &dagconfig.Params{
|
var regressionNetParams = &dagconfig.Params{
|
||||||
Name: "regtest",
|
Name: "regtest",
|
||||||
Net: wire.TestNet,
|
Net: wire.RegTest,
|
||||||
DefaultPort: "18444",
|
DefaultPort: "18444",
|
||||||
|
|
||||||
// DAG parameters
|
// DAG parameters
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/daglabs/btcd/database"
|
"github.com/daglabs/btcd/database"
|
||||||
_ "github.com/daglabs/btcd/database/ffldb"
|
_ "github.com/daglabs/btcd/database/ffldb"
|
||||||
"github.com/daglabs/btcd/util"
|
"github.com/daglabs/btcd/util"
|
||||||
"github.com/daglabs/btcd/wire"
|
|
||||||
flags "github.com/jessevdk/go-flags"
|
flags "github.com/jessevdk/go-flags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ var (
|
|||||||
type config struct {
|
type config struct {
|
||||||
DataDir string `short:"b" long:"datadir" description:"Location of the btcd data directory"`
|
DataDir string `short:"b" long:"datadir" description:"Location of the btcd data directory"`
|
||||||
DbType string `long:"dbtype" description:"Database backend to use for the Block Chain"`
|
DbType string `long:"dbtype" description:"Database backend to use for the Block Chain"`
|
||||||
TestNet3 bool `long:"testnet" description:"Use the test network"`
|
TestNet bool `long:"testnet" description:"Use the test network"`
|
||||||
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
||||||
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
||||||
DevNet bool `long:"devnet" description:"Use the development test network"`
|
DevNet bool `long:"devnet" description:"Use the development test network"`
|
||||||
@ -68,24 +67,6 @@ func validDbType(dbType string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// netName returns the name used when referring to a bitcoin network. At the
|
|
||||||
// time of writing, btcd currently places blocks for testnet version 3 in the
|
|
||||||
// data and log directory "testnet", which does not match the Name field of the
|
|
||||||
// dagconfig parameters. This function can be used to override this directory name
|
|
||||||
// as "testnet" when the passed active network matches wire.TestNet3.
|
|
||||||
//
|
|
||||||
// A proper upgrade to move the data and log directories for this network to
|
|
||||||
// "testnet3" is planned for the future, at which point this function can be
|
|
||||||
// removed and the network parameter's name used instead.
|
|
||||||
func netName(chainParams *dagconfig.Params) string {
|
|
||||||
switch chainParams.Net {
|
|
||||||
case wire.TestNet3:
|
|
||||||
return "testnet"
|
|
||||||
default:
|
|
||||||
return chainParams.Name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// loadConfig initializes and parses the config using command line options.
|
// loadConfig initializes and parses the config using command line options.
|
||||||
func loadConfig() (*config, []string, error) {
|
func loadConfig() (*config, []string, error) {
|
||||||
// Default config.
|
// Default config.
|
||||||
@ -111,9 +92,9 @@ func loadConfig() (*config, []string, error) {
|
|||||||
numNets := 0
|
numNets := 0
|
||||||
// Count number of network flags passed; assign active network params
|
// Count number of network flags passed; assign active network params
|
||||||
// while we're at it
|
// while we're at it
|
||||||
if cfg.TestNet3 {
|
if cfg.TestNet {
|
||||||
numNets++
|
numNets++
|
||||||
activeNetParams = &dagconfig.TestNet3Params
|
activeNetParams = &dagconfig.TestNetParams
|
||||||
}
|
}
|
||||||
if cfg.RegressionTest {
|
if cfg.RegressionTest {
|
||||||
numNets++
|
numNets++
|
||||||
@ -152,7 +133,7 @@ func loadConfig() (*config, []string, error) {
|
|||||||
// All data is specific to a network, so namespacing the data directory
|
// All data is specific to a network, so namespacing the data directory
|
||||||
// means each individual piece of serialized data does not have to
|
// means each individual piece of serialized data does not have to
|
||||||
// worry about changing names per network and such.
|
// worry about changing names per network and such.
|
||||||
cfg.DataDir = filepath.Join(cfg.DataDir, netName(activeNetParams))
|
cfg.DataDir = filepath.Join(cfg.DataDir, activeNetParams.Name)
|
||||||
|
|
||||||
// Ensure the specified block file exists.
|
// Ensure the specified block file exists.
|
||||||
if !fileExists(cfg.InFile) {
|
if !fileExists(cfg.InFile) {
|
||||||
|
@ -66,7 +66,7 @@ func parseConfig() (*config, error) {
|
|||||||
activeNetParams = dagconfig.MainNetParams
|
activeNetParams = dagconfig.MainNetParams
|
||||||
switch {
|
switch {
|
||||||
case cfg.TestNet:
|
case cfg.TestNet:
|
||||||
activeNetParams = dagconfig.TestNet3Params
|
activeNetParams = dagconfig.TestNetParams
|
||||||
case cfg.SimNet:
|
case cfg.SimNet:
|
||||||
activeNetParams = dagconfig.SimNetParams
|
activeNetParams = dagconfig.SimNetParams
|
||||||
case cfg.DevNet:
|
case cfg.DevNet:
|
||||||
|
@ -96,7 +96,7 @@ type config struct {
|
|||||||
Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
|
Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
|
||||||
ProxyUser string `long:"proxyuser" description:"Username for proxy server"`
|
ProxyUser string `long:"proxyuser" description:"Username for proxy server"`
|
||||||
ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"`
|
ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"`
|
||||||
TestNet3 bool `long:"testnet" description:"Connect to testnet"`
|
TestNet bool `long:"testnet" description:"Connect to testnet"`
|
||||||
SimNet bool `long:"simnet" description:"Connect to the simulation test network"`
|
SimNet bool `long:"simnet" description:"Connect to the simulation test network"`
|
||||||
DevNet bool `long:"devnet" description:"Connect to the development test network"`
|
DevNet bool `long:"devnet" description:"Connect to the development test network"`
|
||||||
TLSSkipVerify bool `long:"skipverify" description:"Do not verify tls certificates (not recommended!)"`
|
TLSSkipVerify bool `long:"skipverify" description:"Do not verify tls certificates (not recommended!)"`
|
||||||
@ -104,14 +104,14 @@ type config struct {
|
|||||||
|
|
||||||
// normalizeAddress returns addr with the passed default port appended if
|
// normalizeAddress returns addr with the passed default port appended if
|
||||||
// there is not already a port specified.
|
// there is not already a port specified.
|
||||||
func normalizeAddress(addr string, useTestNet3, useSimNet, useDevNet bool) string {
|
func normalizeAddress(addr string, useTestNet, useSimNet, useDevNet bool) string {
|
||||||
_, _, err := net.SplitHostPort(addr)
|
_, _, err := net.SplitHostPort(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var defaultPort string
|
var defaultPort string
|
||||||
switch {
|
switch {
|
||||||
case useDevNet:
|
case useDevNet:
|
||||||
fallthrough
|
fallthrough
|
||||||
case useTestNet3:
|
case useTestNet:
|
||||||
defaultPort = "18334"
|
defaultPort = "18334"
|
||||||
case useSimNet:
|
case useSimNet:
|
||||||
defaultPort = "18556"
|
defaultPort = "18556"
|
||||||
@ -226,7 +226,7 @@ func loadConfig() (*config, []string, error) {
|
|||||||
|
|
||||||
// Multiple networks can't be selected simultaneously.
|
// Multiple networks can't be selected simultaneously.
|
||||||
numNets := 0
|
numNets := 0
|
||||||
if cfg.TestNet3 {
|
if cfg.TestNet {
|
||||||
numNets++
|
numNets++
|
||||||
}
|
}
|
||||||
if cfg.SimNet {
|
if cfg.SimNet {
|
||||||
@ -248,7 +248,7 @@ func loadConfig() (*config, []string, error) {
|
|||||||
|
|
||||||
// Add default port to RPC server based on --testnet and --simnet flags
|
// Add default port to RPC server based on --testnet and --simnet flags
|
||||||
// if needed.
|
// if needed.
|
||||||
cfg.RPCServer = normalizeAddress(cfg.RPCServer, cfg.TestNet3,
|
cfg.RPCServer = normalizeAddress(cfg.RPCServer, cfg.TestNet,
|
||||||
cfg.SimNet, cfg.DevNet)
|
cfg.SimNet, cfg.DevNet)
|
||||||
|
|
||||||
return &cfg, remainingArgs, nil
|
return &cfg, remainingArgs, nil
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/daglabs/btcd/database"
|
"github.com/daglabs/btcd/database"
|
||||||
_ "github.com/daglabs/btcd/database/ffldb"
|
_ "github.com/daglabs/btcd/database/ffldb"
|
||||||
"github.com/daglabs/btcd/util"
|
"github.com/daglabs/btcd/util"
|
||||||
"github.com/daglabs/btcd/wire"
|
|
||||||
flags "github.com/jessevdk/go-flags"
|
flags "github.com/jessevdk/go-flags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ var (
|
|||||||
type config struct {
|
type config struct {
|
||||||
DataDir string `short:"b" long:"datadir" description:"Location of the btcd data directory"`
|
DataDir string `short:"b" long:"datadir" description:"Location of the btcd data directory"`
|
||||||
DbType string `long:"dbtype" description:"Database backend to use for the Block Chain"`
|
DbType string `long:"dbtype" description:"Database backend to use for the Block Chain"`
|
||||||
TestNet3 bool `long:"testnet" description:"Use the test network"`
|
TestNet bool `long:"testnet" description:"Use the test network"`
|
||||||
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
||||||
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
||||||
DevNet bool `long:"devnet" description:"Use the development test network"`
|
DevNet bool `long:"devnet" description:"Use the development test network"`
|
||||||
@ -57,24 +56,6 @@ func validDbType(dbType string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// netName returns the name used when referring to a bitcoin network. At the
|
|
||||||
// time of writing, btcd currently places blocks for testnet version 3 in the
|
|
||||||
// data and log directory "testnet", which does not match the Name field of the
|
|
||||||
// dagconfig parameters. This function can be used to override this directory name
|
|
||||||
// as "testnet" when the passed active network matches wire.TestNet3.
|
|
||||||
//
|
|
||||||
// A proper upgrade to move the data and log directories for this network to
|
|
||||||
// "testnet3" is planned for the future, at which point this function can be
|
|
||||||
// removed and the network parameter's name used instead.
|
|
||||||
func netName(chainParams *dagconfig.Params) string {
|
|
||||||
switch chainParams.Net {
|
|
||||||
case wire.TestNet3:
|
|
||||||
return "testnet"
|
|
||||||
default:
|
|
||||||
return chainParams.Name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// loadConfig initializes and parses the config using command line options.
|
// loadConfig initializes and parses the config using command line options.
|
||||||
func loadConfig() (*config, []string, error) {
|
func loadConfig() (*config, []string, error) {
|
||||||
// Default config.
|
// Default config.
|
||||||
@ -99,9 +80,9 @@ func loadConfig() (*config, []string, error) {
|
|||||||
numNets := 0
|
numNets := 0
|
||||||
// Count number of network flags passed; assign active network params
|
// Count number of network flags passed; assign active network params
|
||||||
// while we're at it
|
// while we're at it
|
||||||
if cfg.TestNet3 {
|
if cfg.TestNet {
|
||||||
numNets++
|
numNets++
|
||||||
activeNetParams = &dagconfig.TestNet3Params
|
activeNetParams = &dagconfig.TestNetParams
|
||||||
}
|
}
|
||||||
if cfg.RegressionTest {
|
if cfg.RegressionTest {
|
||||||
numNets++
|
numNets++
|
||||||
@ -140,7 +121,7 @@ func loadConfig() (*config, []string, error) {
|
|||||||
// All data is specific to a network, so namespacing the data directory
|
// All data is specific to a network, so namespacing the data directory
|
||||||
// means each individual piece of serialized data does not have to
|
// means each individual piece of serialized data does not have to
|
||||||
// worry about changing names per network and such.
|
// worry about changing names per network and such.
|
||||||
cfg.DataDir = filepath.Join(cfg.DataDir, netName(activeNetParams))
|
cfg.DataDir = filepath.Join(cfg.DataDir, activeNetParams.Name)
|
||||||
|
|
||||||
// Validate the number of candidates.
|
// Validate the number of candidates.
|
||||||
if cfg.NumCandidates < minCandidates || cfg.NumCandidates > maxCandidates {
|
if cfg.NumCandidates < minCandidates || cfg.NumCandidates > maxCandidates {
|
||||||
|
@ -134,7 +134,7 @@ type configFlags struct {
|
|||||||
OnionProxyPass string `long:"onionpass" default-mask:"-" description:"Password for onion proxy server"`
|
OnionProxyPass string `long:"onionpass" default-mask:"-" description:"Password for onion proxy server"`
|
||||||
NoOnion bool `long:"noonion" description:"Disable connecting to tor hidden services"`
|
NoOnion bool `long:"noonion" description:"Disable connecting to tor hidden services"`
|
||||||
TorIsolation bool `long:"torisolation" description:"Enable Tor stream isolation by randomizing user credentials for each connection."`
|
TorIsolation bool `long:"torisolation" description:"Enable Tor stream isolation by randomizing user credentials for each connection."`
|
||||||
TestNet3 bool `long:"testnet" description:"Use the test network"`
|
TestNet bool `long:"testnet" description:"Use the test network"`
|
||||||
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
||||||
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
||||||
DevNet bool `long:"devnet" description:"Use the development test network"`
|
DevNet bool `long:"devnet" description:"Use the development test network"`
|
||||||
@ -428,9 +428,9 @@ func loadConfig() (*Config, []string, error) {
|
|||||||
numNets := 0
|
numNets := 0
|
||||||
// Count number of network flags passed; assign active network params
|
// Count number of network flags passed; assign active network params
|
||||||
// while we're at it
|
// while we're at it
|
||||||
if cfg.TestNet3 {
|
if cfg.TestNet {
|
||||||
numNets++
|
numNets++
|
||||||
activeNetParams = &dagconfig.TestNet3Params
|
activeNetParams = &dagconfig.TestNetParams
|
||||||
}
|
}
|
||||||
if cfg.RegressionTest {
|
if cfg.RegressionTest {
|
||||||
numNets++
|
numNets++
|
||||||
|
@ -38,7 +38,7 @@ func main() {
|
|||||||
|
|
||||||
// Modify active network parameters if operating on testnet.
|
// Modify active network parameters if operating on testnet.
|
||||||
if *testnet {
|
if *testnet {
|
||||||
chainParams = &chaincfg.TestNet3Params
|
chainParams = &chaincfg.TestNetParams
|
||||||
}
|
}
|
||||||
|
|
||||||
// later...
|
// later...
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// In addition to the main Bitcoin network, which is intended for the transfer
|
// In addition to the main Bitcoin network, which is intended for the transfer
|
||||||
// of monetary value, there also exists two currently active standard networks:
|
// of monetary value, there also exists two currently active standard networks:
|
||||||
// regression test and testnet (version 3). These networks are incompatible
|
// regression test and testnet. These networks are incompatible
|
||||||
// with each other (each sharing a different genesis block) and software should
|
// with each other (each sharing a different genesis block) and software should
|
||||||
// handle errors where input intended for one network is used on an application
|
// handle errors where input intended for one network is used on an application
|
||||||
// instance running on a different network.
|
// instance running on a different network.
|
||||||
@ -39,7 +39,7 @@
|
|||||||
//
|
//
|
||||||
// // Modify active network parameters if operating on testnet.
|
// // Modify active network parameters if operating on testnet.
|
||||||
// if *testnet {
|
// if *testnet {
|
||||||
// chainParams = &dagconfig.TestNet3Params
|
// chainParams = &dagconfig.TestNetParams
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // later...
|
// // later...
|
||||||
@ -57,5 +57,5 @@
|
|||||||
// a new Params struct may be created which defines the parameters for the
|
// a new Params struct may be created which defines the parameters for the
|
||||||
// non-standard network. As a general rule of thumb, all network parameters
|
// non-standard network. As a general rule of thumb, all network parameters
|
||||||
// should be unique to the network, but parameter collisions can still occur
|
// should be unique to the network, but parameter collisions can still occur
|
||||||
// (unfortunately, this is the case with regtest and testnet3 sharing magics).
|
// (unfortunately, this is the case with regtest and testnet sharing magics).
|
||||||
package dagconfig
|
package dagconfig
|
||||||
|
@ -36,7 +36,7 @@ var genesisTxPayload = []byte{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
|
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
|
||||||
// the main network, regression test network, and test network (version 3).
|
// the main network, regression test network, and test network.
|
||||||
var genesisCoinbaseTx = wire.NewSubnetworkMsgTx(1, genesisTxIns, genesisTxOuts, subnetworkid.SubnetworkIDCoinbase, 0, genesisTxPayload)
|
var genesisCoinbaseTx = wire.NewSubnetworkMsgTx(1, genesisTxIns, genesisTxOuts, subnetworkid.SubnetworkIDCoinbase, 0, genesisTxPayload)
|
||||||
|
|
||||||
// genesisHash is the hash of the first block in the block DAG for the main
|
// genesisHash is the hash of the first block in the block DAG for the main
|
||||||
@ -86,18 +86,18 @@ var regTestGenesisMerkleRoot = genesisMerkleRoot
|
|||||||
// as the public transaction ledger for the regression test network.
|
// as the public transaction ledger for the regression test network.
|
||||||
var regTestGenesisBlock = genesisBlock
|
var regTestGenesisBlock = genesisBlock
|
||||||
|
|
||||||
// testNet3GenesisHash is the hash of the first block in the block chain for the
|
// testNetGenesisHash is the hash of the first block in the block chain for the
|
||||||
// test network (version 3).
|
// test network.
|
||||||
var testNet3GenesisHash = genesisHash
|
var testNetGenesisHash = genesisHash
|
||||||
|
|
||||||
// testNet3GenesisMerkleRoot is the hash of the first transaction in the genesis
|
// testNetGenesisMerkleRoot is the hash of the first transaction in the genesis
|
||||||
// block for the test network (version 3). It is the same as the merkle root
|
// block for the test network. It is the same as the merkle root for the main
|
||||||
// for the main network.
|
// network.
|
||||||
var testNet3GenesisMerkleRoot = genesisMerkleRoot
|
var testNetGenesisMerkleRoot = genesisMerkleRoot
|
||||||
|
|
||||||
// testNet3GenesisBlock defines the genesis block of the block chain which
|
// testNetGenesisBlock defines the genesis block of the block chain which
|
||||||
// serves as the public transaction ledger for the test network (version 3).
|
// serves as the public transaction ledger for the test network.
|
||||||
var testNet3GenesisBlock = genesisBlock
|
var testNetGenesisBlock = genesisBlock
|
||||||
|
|
||||||
// simNetGenesisHash is the hash of the first block in the block chain for the
|
// simNetGenesisHash is the hash of the first block in the block chain for the
|
||||||
// simulation test network.
|
// simulation test network.
|
||||||
@ -113,7 +113,7 @@ var simNetGenesisMerkleRoot = genesisMerkleRoot
|
|||||||
var simNetGenesisBlock = genesisBlock
|
var simNetGenesisBlock = genesisBlock
|
||||||
|
|
||||||
// devNetGenesisCoinbaseTx is the coinbase transaction for the genesis blocks for
|
// devNetGenesisCoinbaseTx is the coinbase transaction for the genesis blocks for
|
||||||
// the main network, regression test network, and test network (version 3).
|
// the main network, regression test network, and test network.
|
||||||
var devNetGenesisCoinbaseTx = genesisCoinbaseTx
|
var devNetGenesisCoinbaseTx = genesisCoinbaseTx
|
||||||
|
|
||||||
// devGenesisHash is the hash of the first block in the block DAG for the development
|
// devGenesisHash is the hash of the first block in the block DAG for the development
|
||||||
|
@ -64,30 +64,30 @@ func TestRegTestGenesisBlock(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestTestNet3GenesisBlock tests the genesis block of the test network (version
|
// TestTestNetGenesisBlock tests the genesis block of the test network for
|
||||||
// 3) for validity by checking the encoded bytes and hashes.
|
// validity by checking the encoded bytes and hashes.
|
||||||
func TestTestNet3GenesisBlock(t *testing.T) {
|
func TestTestNetGenesisBlock(t *testing.T) {
|
||||||
// Encode the genesis block to raw bytes.
|
// Encode the genesis block to raw bytes.
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
err := TestNet3Params.GenesisBlock.Serialize(&buf)
|
err := TestNetParams.GenesisBlock.Serialize(&buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("TestTestNet3GenesisBlock: %v", err)
|
t.Fatalf("TestTestNetGenesisBlock: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the encoded block matches the expected bytes.
|
// Ensure the encoded block matches the expected bytes.
|
||||||
if !bytes.Equal(buf.Bytes(), testNet3GenesisBlockBytes) {
|
if !bytes.Equal(buf.Bytes(), testNetGenesisBlockBytes) {
|
||||||
t.Fatalf("TestTestNet3GenesisBlock: Genesis block does not "+
|
t.Fatalf("TestTestNetGenesisBlock: Genesis block does not "+
|
||||||
"appear valid - got %v, want %v",
|
"appear valid - got %v, want %v",
|
||||||
spew.Sdump(buf.Bytes()),
|
spew.Sdump(buf.Bytes()),
|
||||||
spew.Sdump(testNet3GenesisBlockBytes))
|
spew.Sdump(testNetGenesisBlockBytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check hash of the block against expected hash.
|
// Check hash of the block against expected hash.
|
||||||
hash := TestNet3Params.GenesisBlock.BlockHash()
|
hash := TestNetParams.GenesisBlock.BlockHash()
|
||||||
if !TestNet3Params.GenesisHash.IsEqual(hash) {
|
if !TestNetParams.GenesisHash.IsEqual(hash) {
|
||||||
t.Fatalf("TestTestNet3GenesisBlock: Genesis block hash does "+
|
t.Fatalf("TestTestNetGenesisBlock: Genesis block hash does "+
|
||||||
"not appear valid - got %v, want %v", spew.Sdump(hash),
|
"not appear valid - got %v, want %v", spew.Sdump(hash),
|
||||||
spew.Sdump(TestNet3Params.GenesisHash))
|
spew.Sdump(TestNetParams.GenesisHash))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,9 +145,9 @@ var genesisBlockBytes = []byte{
|
|||||||
// the regression test network as of protocol version 60002.
|
// the regression test network as of protocol version 60002.
|
||||||
var regTestGenesisBlockBytes = genesisBlockBytes
|
var regTestGenesisBlockBytes = genesisBlockBytes
|
||||||
|
|
||||||
// testNet3GenesisBlockBytes are the wire encoded bytes for the genesis block of
|
// testNetGenesisBlockBytes are the wire encoded bytes for the genesis block of
|
||||||
// the test network (version 3) as of protocol version 60002.
|
// the test network as of protocol version 60002.
|
||||||
var testNet3GenesisBlockBytes = genesisBlockBytes
|
var testNetGenesisBlockBytes = genesisBlockBytes
|
||||||
|
|
||||||
// simNetGenesisBlockBytes are the wire encoded bytes for the genesis block of
|
// simNetGenesisBlockBytes are the wire encoded bytes for the genesis block of
|
||||||
// the simulation test network as of protocol version 70002.
|
// the simulation test network as of protocol version 70002.
|
||||||
|
@ -32,10 +32,9 @@ var (
|
|||||||
// can have for the regression test network. It is the value 2^255 - 1.
|
// can have for the regression test network. It is the value 2^255 - 1.
|
||||||
regressionPowMax = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 255), bigOne)
|
regressionPowMax = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 255), bigOne)
|
||||||
|
|
||||||
// testNet3PowMax is the highest proof of work value a Bitcoin block
|
// testNetPowMax is the highest proof of work value a Bitcoin block
|
||||||
// can have for the test network (version 3). It is the value
|
// can have for the test network. It is the value 2^255 - 1.
|
||||||
// 2^255 - 1.
|
testNetPowMax = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 255), bigOne)
|
||||||
testNet3PowMax = new(big.Int).Sub(new(big.Int).Lsh(bigOne, 255), bigOne)
|
|
||||||
|
|
||||||
// simNetPowMax is the highest proof of work value a Bitcoin block
|
// simNetPowMax is the highest proof of work value a Bitcoin block
|
||||||
// can have for the simulation test network. It is the value 2^255 - 1.
|
// can have for the simulation test network. It is the value 2^255 - 1.
|
||||||
@ -254,7 +253,7 @@ var MainNetParams = Params{
|
|||||||
var RegressionNetParams = Params{
|
var RegressionNetParams = Params{
|
||||||
K: phantomK,
|
K: phantomK,
|
||||||
Name: "regtest",
|
Name: "regtest",
|
||||||
Net: wire.TestNet,
|
Net: wire.RegTest,
|
||||||
RPCPort: "18334",
|
RPCPort: "18334",
|
||||||
DefaultPort: "18444",
|
DefaultPort: "18444",
|
||||||
DNSSeeds: []string{},
|
DNSSeeds: []string{},
|
||||||
@ -308,21 +307,19 @@ var RegressionNetParams = Params{
|
|||||||
HDCoinType: 1,
|
HDCoinType: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestNet3Params defines the network parameters for the test Bitcoin network
|
// TestNetParams defines the network parameters for the test Bitcoin network.
|
||||||
// (version 3). Not to be confused with the regression test network, this
|
var TestNetParams = Params{
|
||||||
// network is sometimes simply called "testnet".
|
|
||||||
var TestNet3Params = Params{
|
|
||||||
K: phantomK,
|
K: phantomK,
|
||||||
Name: "testnet3",
|
Name: "testnet",
|
||||||
Net: wire.TestNet3,
|
Net: wire.TestNet,
|
||||||
RPCPort: "18334",
|
RPCPort: "18334",
|
||||||
DefaultPort: "18333",
|
DefaultPort: "18333",
|
||||||
DNSSeeds: []string{},
|
DNSSeeds: []string{},
|
||||||
|
|
||||||
// DAG parameters
|
// DAG parameters
|
||||||
GenesisBlock: &testNet3GenesisBlock,
|
GenesisBlock: &testNetGenesisBlock,
|
||||||
GenesisHash: &testNet3GenesisHash,
|
GenesisHash: &testNetGenesisHash,
|
||||||
PowMax: testNet3PowMax,
|
PowMax: testNetPowMax,
|
||||||
BlockCoinbaseMaturity: 100,
|
BlockCoinbaseMaturity: 100,
|
||||||
SubsidyReductionInterval: 210000,
|
SubsidyReductionInterval: 210000,
|
||||||
TargetTimePerBlock: time.Second * 1, // 1 second
|
TargetTimePerBlock: time.Second * 1, // 1 second
|
||||||
@ -547,7 +544,7 @@ func newHashFromStr(hexStr string) *daghash.Hash {
|
|||||||
func init() {
|
func init() {
|
||||||
// Register all default networks when the package is initialized.
|
// Register all default networks when the package is initialized.
|
||||||
mustRegister(&MainNetParams)
|
mustRegister(&MainNetParams)
|
||||||
mustRegister(&TestNet3Params)
|
mustRegister(&TestNetParams)
|
||||||
mustRegister(&RegressionNetParams)
|
mustRegister(&RegressionNetParams)
|
||||||
mustRegister(&SimNetParams)
|
mustRegister(&SimNetParams)
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ func TestRegister(t *testing.T) {
|
|||||||
err: ErrDuplicateNet,
|
err: ErrDuplicateNet,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "duplicate testnet3",
|
name: "duplicate testnet",
|
||||||
params: &TestNet3Params,
|
params: &TestNetParams,
|
||||||
err: ErrDuplicateNet,
|
err: ErrDuplicateNet,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -69,8 +69,8 @@ func TestRegister(t *testing.T) {
|
|||||||
err: nil,
|
err: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
priv: TestNet3Params.HDKeyIDPair.PrivateKeyID[:],
|
priv: TestNetParams.HDKeyIDPair.PrivateKeyID[:],
|
||||||
want: TestNet3Params.HDKeyIDPair.PublicKeyID[:],
|
want: TestNetParams.HDKeyIDPair.PublicKeyID[:],
|
||||||
err: nil,
|
err: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -128,8 +128,8 @@ func TestRegister(t *testing.T) {
|
|||||||
err: ErrDuplicateNet,
|
err: ErrDuplicateNet,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "duplicate testnet3",
|
name: "duplicate testnet",
|
||||||
params: &TestNet3Params,
|
params: &TestNetParams,
|
||||||
err: ErrDuplicateNet,
|
err: ErrDuplicateNet,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -150,8 +150,8 @@ func TestRegister(t *testing.T) {
|
|||||||
err: nil,
|
err: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
priv: TestNet3Params.HDKeyIDPair.PrivateKeyID[:],
|
priv: TestNetParams.HDKeyIDPair.PrivateKeyID[:],
|
||||||
want: TestNet3Params.HDKeyIDPair.PublicKeyID[:],
|
want: TestNetParams.HDKeyIDPair.PublicKeyID[:],
|
||||||
err: nil,
|
err: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
"github.com/daglabs/btcd/database"
|
"github.com/daglabs/btcd/database"
|
||||||
_ "github.com/daglabs/btcd/database/ffldb"
|
_ "github.com/daglabs/btcd/database/ffldb"
|
||||||
"github.com/daglabs/btcd/util"
|
"github.com/daglabs/btcd/util"
|
||||||
"github.com/daglabs/btcd/wire"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -34,7 +33,7 @@ var (
|
|||||||
type config struct {
|
type config struct {
|
||||||
DataDir string `short:"b" long:"datadir" description:"Location of the btcd data directory"`
|
DataDir string `short:"b" long:"datadir" description:"Location of the btcd data directory"`
|
||||||
DbType string `long:"dbtype" description:"Database backend to use for the Block Chain"`
|
DbType string `long:"dbtype" description:"Database backend to use for the Block Chain"`
|
||||||
TestNet3 bool `long:"testnet" description:"Use the test network"`
|
TestNet bool `long:"testnet" description:"Use the test network"`
|
||||||
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
|
||||||
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
SimNet bool `long:"simnet" description:"Use the simulation test network"`
|
||||||
DevNet bool `long:"devnet" description:"Use the development test network"`
|
DevNet bool `long:"devnet" description:"Use the development test network"`
|
||||||
@ -61,24 +60,6 @@ func validDbType(dbType string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// netName returns the name used when referring to a bitcoin network. At the
|
|
||||||
// time of writing, btcd currently places blocks for testnet version 3 in the
|
|
||||||
// data and log directory "testnet", which does not match the Name field of the
|
|
||||||
// dagconfig parameters. This function can be used to override this directory name
|
|
||||||
// as "testnet" when the passed active network matches wire.TestNet3.
|
|
||||||
//
|
|
||||||
// A proper upgrade to move the data and log directories for this network to
|
|
||||||
// "testnet3" is planned for the future, at which point this function can be
|
|
||||||
// removed and the network parameter's name used instead.
|
|
||||||
func netName(chainParams *dagconfig.Params) string {
|
|
||||||
switch chainParams.Net {
|
|
||||||
case wire.TestNet3:
|
|
||||||
return "testnet"
|
|
||||||
default:
|
|
||||||
return chainParams.Name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// setupGlobalConfig examine the global configuration options for any conditions
|
// setupGlobalConfig examine the global configuration options for any conditions
|
||||||
// which are invalid as well as performs any addition setup necessary after the
|
// which are invalid as well as performs any addition setup necessary after the
|
||||||
// initial parse.
|
// initial parse.
|
||||||
@ -87,9 +68,9 @@ func setupGlobalConfig() error {
|
|||||||
// Count number of network flags passed; assign active network params
|
// Count number of network flags passed; assign active network params
|
||||||
// while we're at it
|
// while we're at it
|
||||||
numNets := 0
|
numNets := 0
|
||||||
if cfg.TestNet3 {
|
if cfg.TestNet {
|
||||||
numNets++
|
numNets++
|
||||||
activeNetParams = &dagconfig.TestNet3Params
|
activeNetParams = &dagconfig.TestNetParams
|
||||||
}
|
}
|
||||||
if cfg.RegressionTest {
|
if cfg.RegressionTest {
|
||||||
numNets++
|
numNets++
|
||||||
@ -121,7 +102,7 @@ func setupGlobalConfig() error {
|
|||||||
// All data is specific to a network, so namespacing the data directory
|
// All data is specific to a network, so namespacing the data directory
|
||||||
// means each individual piece of serialized data does not have to
|
// means each individual piece of serialized data does not have to
|
||||||
// worry about changing names per network and such.
|
// worry about changing names per network and such.
|
||||||
cfg.DataDir = filepath.Join(cfg.DataDir, netName(activeNetParams))
|
cfg.DataDir = filepath.Join(cfg.DataDir, activeNetParams.Name)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ func loadConfig() (*config, error) {
|
|||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if cfg.TestNet {
|
} else if cfg.TestNet {
|
||||||
activeNetParams = &dagconfig.TestNet3Params
|
activeNetParams = &dagconfig.TestNetParams
|
||||||
} else if cfg.DevNet {
|
} else if cfg.DevNet {
|
||||||
activeNetParams = &dagconfig.DevNetParams
|
activeNetParams = &dagconfig.DevNetParams
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ The following is an overview of the RPC methods which are implemented by btcd, b
|
|||||||
|Parameters|None|
|
|Parameters|None|
|
||||||
|Description|Get bitcoin network btcd is running on.|
|
|Description|Get bitcoin network btcd is running on.|
|
||||||
|Returns|numeric|
|
|Returns|numeric|
|
||||||
|Example Return|`3652501241` (mainnet)<br />`118034699` (testnet3)|
|
|Example Return|`3652501241` (mainnet)<br />`118034699` (testnet)|
|
||||||
[Return to Overview](#ExtMethodOverview)<br />
|
[Return to Overview](#ExtMethodOverview)<br />
|
||||||
|
|
||||||
***
|
***
|
||||||
|
@ -109,9 +109,9 @@ func New(activeNet *dagconfig.Params, handlers *rpcclient.NotificationHandlers,
|
|||||||
switch activeNet.Net {
|
switch activeNet.Net {
|
||||||
case wire.MainNet:
|
case wire.MainNet:
|
||||||
// No extra flags since mainnet is the default
|
// No extra flags since mainnet is the default
|
||||||
case wire.TestNet3:
|
|
||||||
extraArgs = append(extraArgs, "--testnet")
|
|
||||||
case wire.TestNet:
|
case wire.TestNet:
|
||||||
|
extraArgs = append(extraArgs, "--testnet")
|
||||||
|
case wire.RegTest:
|
||||||
extraArgs = append(extraArgs, "--regtest")
|
extraArgs = append(extraArgs, "--regtest")
|
||||||
case wire.SimNet:
|
case wire.SimNet:
|
||||||
extraArgs = append(extraArgs, "--simnet")
|
extraArgs = append(extraArgs, "--simnet")
|
||||||
|
@ -1146,7 +1146,7 @@ func (p *Peer) writeMessage(msg wire.Message) error {
|
|||||||
// to send malformed messages without the peer being disconnected.
|
// to send malformed messages without the peer being disconnected.
|
||||||
func (p *Peer) isAllowedReadError(err error) bool {
|
func (p *Peer) isAllowedReadError(err error) bool {
|
||||||
// Only allow read errors in regression test mode.
|
// Only allow read errors in regression test mode.
|
||||||
if p.cfg.DAGParams.Net != wire.TestNet {
|
if p.cfg.DAGParams.Net != wire.RegTest {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2064,7 +2064,7 @@ func newPeerBase(origCfg *Config, inbound bool) *Peer {
|
|||||||
|
|
||||||
// Set the DAG parameters to testnet if the caller did not specify any.
|
// Set the DAG parameters to testnet if the caller did not specify any.
|
||||||
if cfg.DAGParams == nil {
|
if cfg.DAGParams == nil {
|
||||||
cfg.DAGParams = &dagconfig.TestNet3Params
|
cfg.DAGParams = &dagconfig.TestNetParams
|
||||||
}
|
}
|
||||||
|
|
||||||
p := Peer{
|
p := Peer{
|
||||||
|
@ -17,7 +17,7 @@ func handleGetInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) (inter
|
|||||||
Connections: s.cfg.ConnMgr.ConnectedCount(),
|
Connections: s.cfg.ConnMgr.ConnectedCount(),
|
||||||
Proxy: config.MainConfig().Proxy,
|
Proxy: config.MainConfig().Proxy,
|
||||||
Difficulty: getDifficultyRatio(s.cfg.DAG.CurrentBits(), s.cfg.DAGParams),
|
Difficulty: getDifficultyRatio(s.cfg.DAG.CurrentBits(), s.cfg.DAGParams),
|
||||||
TestNet: config.MainConfig().TestNet3,
|
TestNet: config.MainConfig().TestNet,
|
||||||
DevNet: config.MainConfig().DevNet,
|
DevNet: config.MainConfig().DevNet,
|
||||||
RelayFee: config.MainConfig().MinRelayTxFee.ToBTC(),
|
RelayFee: config.MainConfig().MinRelayTxFee.ToBTC(),
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func handleGetMiningInfo(s *Server, cmd interface{}, closeChan <-chan struct{})
|
|||||||
HashesPerSec: int64(s.cfg.CPUMiner.HashesPerSecond()),
|
HashesPerSec: int64(s.cfg.CPUMiner.HashesPerSecond()),
|
||||||
NetworkHashPS: networkHashesPerSec,
|
NetworkHashPS: networkHashesPerSec,
|
||||||
PooledTx: uint64(s.cfg.TxMemPool.Count()),
|
PooledTx: uint64(s.cfg.TxMemPool.Count()),
|
||||||
TestNet: config.MainConfig().TestNet3,
|
TestNet: config.MainConfig().TestNet,
|
||||||
DevNet: config.MainConfig().DevNet,
|
DevNet: config.MainConfig().DevNet,
|
||||||
}
|
}
|
||||||
return &result, nil
|
return &result, nil
|
||||||
|
@ -76,7 +76,7 @@ func signAndCheck(msg string, tx *wire.MsgTx, idx int, scriptPubKey []byte,
|
|||||||
hashType SigHashType, kdb KeyDB, sdb ScriptDB,
|
hashType SigHashType, kdb KeyDB, sdb ScriptDB,
|
||||||
previousScript []byte) error {
|
previousScript []byte) error {
|
||||||
|
|
||||||
sigScript, err := SignTxOutput(&dagconfig.TestNet3Params, tx, idx,
|
sigScript, err := SignTxOutput(&dagconfig.TestNetParams, tx, idx,
|
||||||
scriptPubKey, hashType, kdb, sdb, nil)
|
scriptPubKey, hashType, kdb, sdb, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to sign output %s: %v", msg, err)
|
return fmt.Errorf("failed to sign output %s: %v", msg, err)
|
||||||
@ -199,7 +199,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
"for %s: %v", msg, err)
|
"for %s: %v", msg, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigScript, err := SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err := SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptPubKey, hashType,
|
tx, i, scriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, false},
|
address.EncodeAddress(): {key, false},
|
||||||
@ -212,7 +212,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
|
|
||||||
// by the above loop, this should be valid, now sign
|
// by the above loop, this should be valid, now sign
|
||||||
// again and merge.
|
// again and merge.
|
||||||
sigScript, err = SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err = SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptPubKey, hashType,
|
tx, i, scriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, false},
|
address.EncodeAddress(): {key, false},
|
||||||
@ -298,7 +298,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
"for %s: %v", msg, err)
|
"for %s: %v", msg, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sigScript, err := SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err := SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptPubKey, hashType,
|
tx, i, scriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, true},
|
address.EncodeAddress(): {key, true},
|
||||||
@ -311,7 +311,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
|
|
||||||
// by the above loop, this should be valid, now sign
|
// by the above loop, this should be valid, now sign
|
||||||
// again and merge.
|
// again and merge.
|
||||||
sigScript, err = SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err = SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptPubKey, hashType,
|
tx, i, scriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, true},
|
address.EncodeAddress(): {key, true},
|
||||||
@ -432,7 +432,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
sigScript, err := SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err := SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptScriptPubKey, hashType,
|
tx, i, scriptScriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, false},
|
address.EncodeAddress(): {key, false},
|
||||||
@ -447,7 +447,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
|
|
||||||
// by the above loop, this should be valid, now sign
|
// by the above loop, this should be valid, now sign
|
||||||
// again and merge.
|
// again and merge.
|
||||||
sigScript, err = SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err = SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptScriptPubKey, hashType,
|
tx, i, scriptScriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, false},
|
address.EncodeAddress(): {key, false},
|
||||||
@ -569,7 +569,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
sigScript, err := SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err := SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptScriptPubKey, hashType,
|
tx, i, scriptScriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, true},
|
address.EncodeAddress(): {key, true},
|
||||||
@ -584,7 +584,7 @@ func TestSignTxOutput(t *testing.T) {
|
|||||||
|
|
||||||
// by the above loop, this should be valid, now sign
|
// by the above loop, this should be valid, now sign
|
||||||
// again and merge.
|
// again and merge.
|
||||||
sigScript, err = SignTxOutput(&dagconfig.TestNet3Params,
|
sigScript, err = SignTxOutput(&dagconfig.TestNetParams,
|
||||||
tx, i, scriptScriptPubKey, hashType,
|
tx, i, scriptScriptPubKey, hashType,
|
||||||
mkGetKey(map[string]addressToKey{
|
mkGetKey(map[string]addressToKey{
|
||||||
address.EncodeAddress(): {key, true},
|
address.EncodeAddress(): {key, true},
|
||||||
|
@ -64,7 +64,7 @@ func (w *WIF) IsForNet(privateKeyID byte) bool {
|
|||||||
// sequence:
|
// sequence:
|
||||||
//
|
//
|
||||||
// * 1 byte to identify the network, must be 0x80 for mainnet or 0xef for
|
// * 1 byte to identify the network, must be 0x80 for mainnet or 0xef for
|
||||||
// either testnet3 or the regression test network
|
// either testnet or the regression test network
|
||||||
// * 32 bytes of a binary-encoded, big-endian, zero-padded private key
|
// * 32 bytes of a binary-encoded, big-endian, zero-padded private key
|
||||||
// * Optional 1 byte (equal to 0x01) if the address being imported or exported
|
// * Optional 1 byte (equal to 0x01) if the address being imported or exported
|
||||||
// was created by taking the RIPEMD160 after SHA256 hash of a serialized
|
// was created by taking the RIPEMD160 after SHA256 hash of a serialized
|
||||||
|
@ -29,7 +29,7 @@ func TestEncodeDecodeWIF(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
wif2, err := NewWIF(priv2, dagconfig.TestNet3Params.PrivateKeyID, true)
|
wif2, err := NewWIF(priv2, dagconfig.TestNetParams.PrivateKeyID, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
|
// genesisCoinbaseTx is the coinbase transaction for the genesis blocks for
|
||||||
// the main network, regression test network, and test network (version 3).
|
// the main network, regression test network, and test network.
|
||||||
var genesisCoinbaseTxIns = []*TxIn{
|
var genesisCoinbaseTxIns = []*TxIn{
|
||||||
{
|
{
|
||||||
PreviousOutpoint: Outpoint{
|
PreviousOutpoint: Outpoint{
|
||||||
|
@ -84,8 +84,8 @@ message and which bitcoin network the message applies to. This package provides
|
|||||||
the following constants:
|
the following constants:
|
||||||
|
|
||||||
wire.MainNet
|
wire.MainNet
|
||||||
wire.TestNet (Regression test network)
|
wire.RegTest (Regression test network)
|
||||||
wire.TestNet3 (Test network version 3)
|
wire.TestNet (Test network)
|
||||||
wire.SimNet (Simulation test network)
|
wire.SimNet (Simulation test network)
|
||||||
|
|
||||||
Determining Message Type
|
Determining Message Type
|
||||||
|
@ -208,8 +208,8 @@ func TestReadMessageWireErrors(t *testing.T) {
|
|||||||
testErr.Error(), wantErr)
|
testErr.Error(), wantErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wire encoded bytes for main and testnet3 networks magic identifiers.
|
// Wire encoded bytes for main and testnet networks magic identifiers.
|
||||||
testNet3Bytes := makeHeader(TestNet3, "", 0, 0)
|
testNetBytes := makeHeader(TestNet, "", 0, 0)
|
||||||
|
|
||||||
// Wire encoded bytes for a message that exceeds max overall message
|
// Wire encoded bytes for a message that exceeds max overall message
|
||||||
// length.
|
// length.
|
||||||
@ -267,12 +267,12 @@ func TestReadMessageWireErrors(t *testing.T) {
|
|||||||
0,
|
0,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Wrong network. Want MainNet, but giving TestNet3.
|
// Wrong network. Want MainNet, but giving TestNet.
|
||||||
{
|
{
|
||||||
testNet3Bytes,
|
testNetBytes,
|
||||||
pver,
|
pver,
|
||||||
btcnet,
|
btcnet,
|
||||||
len(testNet3Bytes),
|
len(testNetBytes),
|
||||||
&MessageError{},
|
&MessageError{},
|
||||||
24,
|
24,
|
||||||
},
|
},
|
||||||
|
@ -100,11 +100,11 @@ const (
|
|||||||
// MainNet represents the main bitcoin network.
|
// MainNet represents the main bitcoin network.
|
||||||
MainNet BitcoinNet = 0xd9b4bef9
|
MainNet BitcoinNet = 0xd9b4bef9
|
||||||
|
|
||||||
// TestNet represents the regression test network.
|
// TestNet represents the test network.
|
||||||
TestNet BitcoinNet = 0xdab5bffa
|
TestNet BitcoinNet = 0x0709110b
|
||||||
|
|
||||||
// TestNet3 represents the test network (version 3).
|
// RegTest represents the regression test network.
|
||||||
TestNet3 BitcoinNet = 0x0709110b
|
RegTest BitcoinNet = 0xdab5bffa
|
||||||
|
|
||||||
// SimNet represents the simulation test network.
|
// SimNet represents the simulation test network.
|
||||||
SimNet BitcoinNet = 0x12141c16
|
SimNet BitcoinNet = 0x12141c16
|
||||||
@ -118,7 +118,7 @@ const (
|
|||||||
var bnStrings = map[BitcoinNet]string{
|
var bnStrings = map[BitcoinNet]string{
|
||||||
MainNet: "MainNet",
|
MainNet: "MainNet",
|
||||||
TestNet: "TestNet",
|
TestNet: "TestNet",
|
||||||
TestNet3: "TestNet3",
|
RegTest: "RegTest",
|
||||||
SimNet: "SimNet",
|
SimNet: "SimNet",
|
||||||
DevNet: "DevNet",
|
DevNet: "DevNet",
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ func TestBitcoinNetStringer(t *testing.T) {
|
|||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
{MainNet, "MainNet"},
|
{MainNet, "MainNet"},
|
||||||
|
{RegTest, "RegTest"},
|
||||||
{TestNet, "TestNet"},
|
{TestNet, "TestNet"},
|
||||||
{TestNet3, "TestNet3"},
|
|
||||||
{SimNet, "SimNet"},
|
{SimNet, "SimNet"},
|
||||||
{0xffffffff, "Unknown BitcoinNet (4294967295)"},
|
{0xffffffff, "Unknown BitcoinNet (4294967295)"},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user