Add support for the simulation test network.
This commit is contained in:
parent
04338d31c9
commit
6398dc098e
3 changed files with 37 additions and 4 deletions
27
config.go
27
config.go
|
@ -49,10 +49,10 @@ var (
|
||||||
type config struct {
|
type config struct {
|
||||||
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
|
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
|
||||||
CAFile string `long:"cafile" description:"File containing root certificates to authenticate a TLS connections with btcd"`
|
CAFile string `long:"cafile" description:"File containing root certificates to authenticate a TLS connections with btcd"`
|
||||||
RPCConnect string `short:"c" long:"rpcconnect" description:"Hostname/IP and port of btcd RPC server to connect to (default localhost:18334, mainnet: localhost:8334)"`
|
RPCConnect string `short:"c" long:"rpcconnect" description:"Hostname/IP and port of btcd RPC server to connect to (default localhost:18334, mainnet: localhost:8334, simnet: localhost:18556)"`
|
||||||
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"`
|
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"`
|
||||||
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
|
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
|
||||||
SvrListeners []string `long:"rpclisten" description:"Listen for RPC/websocket connections on this interface/port (default port: 18332, mainnet: 8332)"`
|
SvrListeners []string `long:"rpclisten" description:"Listen for RPC/websocket connections on this interface/port (default port: 18332, mainnet: 8332, simnet: 18555)"`
|
||||||
DataDir string `short:"D" long:"datadir" description:"Directory to store wallets and transactions"`
|
DataDir string `short:"D" long:"datadir" description:"Directory to store wallets and transactions"`
|
||||||
Username string `short:"u" long:"username" description:"Username for client and btcd authorization"`
|
Username string `short:"u" long:"username" description:"Username for client and btcd authorization"`
|
||||||
Password string `short:"P" long:"password" default-mask:"-" description:"Password for client and btcd authorization"`
|
Password string `short:"P" long:"password" default-mask:"-" description:"Password for client and btcd authorization"`
|
||||||
|
@ -61,6 +61,7 @@ type config struct {
|
||||||
RPCCert string `long:"rpccert" description:"File containing the certificate file"`
|
RPCCert string `long:"rpccert" description:"File containing the certificate file"`
|
||||||
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
||||||
MainNet bool `long:"mainnet" description:"Use the main Bitcoin network (default testnet3)"`
|
MainNet bool `long:"mainnet" description:"Use the main Bitcoin network (default testnet3)"`
|
||||||
|
SimNet bool `long:"simnet" description:"Use the simulation test network (default testnet3)"`
|
||||||
KeypoolSize uint `short:"k" long:"keypoolsize" description:"Maximum number of addresses in keypool"`
|
KeypoolSize uint `short:"k" long:"keypoolsize" description:"Maximum number of addresses in keypool"`
|
||||||
DisallowFree bool `long:"disallowfree" description:"Force transactions to always include a fee"`
|
DisallowFree bool `long:"disallowfree" description:"Force transactions to always include a fee"`
|
||||||
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)"`
|
||||||
|
@ -217,9 +218,29 @@ func loadConfig() (*config, []string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose the active network params based on the mainnet net flag.
|
// Multiple networks can't be selected simultaneously.
|
||||||
|
numNets := 0
|
||||||
if cfg.MainNet {
|
if cfg.MainNet {
|
||||||
|
numNets++
|
||||||
|
}
|
||||||
|
if cfg.SimNet {
|
||||||
|
numNets++
|
||||||
|
}
|
||||||
|
if numNets > 1 {
|
||||||
|
str := "%s: The mainnet and simnet params can't be used " +
|
||||||
|
"togther -- choose one"
|
||||||
|
err := fmt.Errorf(str, "loadConfig")
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
parser.WriteHelp(os.Stderr)
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Choose the active network params based on the selected network.
|
||||||
|
switch {
|
||||||
|
case cfg.MainNet:
|
||||||
activeNet = &mainNetParams
|
activeNet = &mainNetParams
|
||||||
|
case cfg.SimNet:
|
||||||
|
activeNet = &simNetParams
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate debug log level
|
// Validate debug log level
|
||||||
|
|
|
@ -48,3 +48,12 @@ var testNet3Params = params{
|
||||||
btcdPort: "18334",
|
btcdPort: "18334",
|
||||||
svrPort: "18332",
|
svrPort: "18332",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// simNetParams contains parameters specific to the simulation test network
|
||||||
|
// (btcwire.SimNet).
|
||||||
|
var simNetParams = params{
|
||||||
|
Params: &btcnet.SimNetParams,
|
||||||
|
connect: "localhost:18556",
|
||||||
|
btcdPort: "18556",
|
||||||
|
svrPort: "18555",
|
||||||
|
}
|
||||||
|
|
|
@ -4,9 +4,12 @@
|
||||||
; Bitcoin wallet settings
|
; Bitcoin wallet settings
|
||||||
; ------------------------------------------------------------------------------
|
; ------------------------------------------------------------------------------
|
||||||
|
|
||||||
; Use mainnet.
|
; Use mainnet (cannot be used with simnet=1).
|
||||||
; mainnet=0
|
; mainnet=0
|
||||||
|
|
||||||
|
; Use simnet (cannot be used with mainnet=1).
|
||||||
|
; simnet=0
|
||||||
|
|
||||||
; The directory to open and save wallet, transaction, and unspent transaction
|
; The directory to open and save wallet, transaction, and unspent transaction
|
||||||
; output files. Two directories, `mainnet` and `testnet` are used in this
|
; output files. Two directories, `mainnet` and `testnet` are used in this
|
||||||
; directory for mainnet and testnet wallets, respectively.
|
; directory for mainnet and testnet wallets, respectively.
|
||||||
|
|
Loading…
Reference in a new issue