cmd: add TestNet4 config param

This commit is contained in:
Oleg Bondar 2025-02-10 17:01:14 +00:00 committed by Olaoluwa Osuntokun
parent b31d0554cc
commit 9b258bd3cc
3 changed files with 24 additions and 3 deletions

View file

@ -42,7 +42,8 @@ type config struct {
Progress int `short:"p" long:"progress" description:"Show a progress message each time this number of seconds have passed -- Use 0 to disable progress announcements"` Progress int `short:"p" long:"progress" description:"Show a progress message each time this number of seconds have passed -- Use 0 to disable progress announcements"`
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"`
TestNet3 bool `long:"testnet" description:"Use the test network"` TestNet3 bool `long:"testnet" description:"Use the test network (version 3)"`
TestNet4 bool `long:"testnet4" description:"Use the test network (version 4)"`
TxIndex bool `long:"txindex" description:"Build a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC"` TxIndex bool `long:"txindex" description:"Build a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC"`
} }
@ -108,6 +109,10 @@ func loadConfig() (*config, []string, error) {
numNets++ numNets++
activeNetParams = &chaincfg.TestNet3Params activeNetParams = &chaincfg.TestNet3Params
} }
if cfg.TestNet4 {
numNets++
activeNetParams = &chaincfg.TestNet4Params
}
if cfg.RegressionTest { if cfg.RegressionTest {
numNets++ numNets++
activeNetParams = &chaincfg.RegressionNetParams activeNetParams = &chaincfg.RegressionNetParams

View file

@ -106,7 +106,8 @@ type config struct {
RPCUser string `short:"u" long:"rpcuser" description:"RPC username"` RPCUser string `short:"u" long:"rpcuser" description:"RPC username"`
SimNet bool `long:"simnet" description:"Connect to the simulation test network"` SimNet bool `long:"simnet" description:"Connect to the simulation 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!)"`
TestNet3 bool `long:"testnet" description:"Connect to testnet"` TestNet3 bool `long:"testnet" description:"Connect to testnet (version 3)"`
TestNet4 bool `long:"testnet4" description:"Connect to testnet (version 4)"`
SigNet bool `long:"signet" description:"Connect to signet"` SigNet bool `long:"signet" description:"Connect to signet"`
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
Wallet bool `long:"wallet" description:"Connect to wallet"` Wallet bool `long:"wallet" description:"Connect to wallet"`
@ -125,6 +126,12 @@ func normalizeAddress(addr string, chain *chaincfg.Params, useWallet bool) (stri
} else { } else {
defaultPort = "18334" defaultPort = "18334"
} }
case &chaincfg.TestNet4Params:
if useWallet {
defaultPort = "48332"
} else {
defaultPort = "48334"
}
case &chaincfg.SimNetParams: case &chaincfg.SimNetParams:
if useWallet { if useWallet {
defaultPort = "18554" defaultPort = "18554"
@ -272,6 +279,10 @@ func loadConfig() (*config, []string, error) {
numNets++ numNets++
network = &chaincfg.TestNet3Params network = &chaincfg.TestNet3Params
} }
if cfg.TestNet4 {
numNets++
network = &chaincfg.TestNet4Params
}
if cfg.SimNet { if cfg.SimNet {
numNets++ numNets++
network = &chaincfg.SimNetParams network = &chaincfg.SimNetParams

View file

@ -42,7 +42,8 @@ type config struct {
NumCandidates int `short:"n" long:"numcandidates" description:"Max num of checkpoint candidates to show {1-20}"` NumCandidates int `short:"n" long:"numcandidates" description:"Max num of checkpoint candidates to show {1-20}"`
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"`
TestNet3 bool `long:"testnet" description:"Use the test network"` TestNet3 bool `long:"testnet" description:"Use the test network (version 3)"`
TestNet4 bool `long:"testnet4" description:"Use the test network (version 4)"`
} }
// validDbType returns whether or not dbType is a supported database type. // validDbType returns whether or not dbType is a supported database type.
@ -96,6 +97,10 @@ func loadConfig() (*config, []string, error) {
numNets++ numNets++
activeNetParams = &chaincfg.TestNet3Params activeNetParams = &chaincfg.TestNet3Params
} }
if cfg.TestNet4 {
numNets++
activeNetParams = &chaincfg.TestNet4Params
}
if cfg.RegressionTest { if cfg.RegressionTest {
numNets++ numNets++
activeNetParams = &chaincfg.RegressionNetParams activeNetParams = &chaincfg.RegressionNetParams