1
0
Fork 0
mirror of https://github.com/btcsuite/btcd.git synced 2025-03-13 11:35:52 +01:00

btcd: add TestNet4 config param

This commit is contained in:
Oleg Bondar 2025-02-10 17:06:09 +00:00 committed by Olaoluwa Osuntokun
parent 029a730319
commit fe4db21e6c
3 changed files with 16 additions and 3 deletions

View file

@ -171,7 +171,8 @@ type config struct {
SigNet bool `long:"signet" description:"Use the signet test network"`
SigNetChallenge string `long:"signetchallenge" description:"Connect to a custom signet network defined by this challenge instead of using the global default signet test network -- Can be specified multiple times"`
SigNetSeedNode []string `long:"signetseednode" description:"Specify a seed node for the signet network instead of using the global default signet network seed nodes"`
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)"`
TorIsolation bool `long:"torisolation" description:"Enable Tor stream isolation by randomizing user credentials for each connection."`
TrickleInterval time.Duration `long:"trickleinterval" description:"Minimum time between attempts to send new inventory to a connected peer"`
UtxoCacheMaxSizeMiB uint `long:"utxocachemaxsize" description:"The maximum size in MiB of the UTXO cache"`
@ -548,6 +549,10 @@ func loadConfig() (*config, []string, error) {
numNets++
activeNetParams = &testNet3Params
}
if cfg.TestNet4 {
numNets++
activeNetParams = &testNet4Params
}
if cfg.RegressionTest {
numNets++
activeNetParams = &regressionNetParams

View file

@ -48,6 +48,14 @@ var testNet3Params = params{
rpcPort: "18334",
}
// testNet4Params contains parameters specific to the test network (version 4)
// (wire.TestNet4). NOTE: The RPC port is intentionally different from the
// reference implementation - see the mainNetParams comment for details.
var testNet4Params = params{
Params: &chaincfg.TestNet4Params,
rpcPort: "48334",
}
// simNetParams contains parameters specific to the simulation test network
// (wire.SimNet).
var simNetParams = params{

View file

@ -2358,7 +2358,7 @@ func handleGetInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (in
Connections: s.cfg.ConnMgr.ConnectedCount(),
Proxy: cfg.Proxy,
Difficulty: getDifficultyRatio(best.Bits, s.cfg.ChainParams),
TestNet: cfg.TestNet3,
TestNet: cfg.TestNet3 || cfg.TestNet4,
RelayFee: cfg.minRelayTxFee.ToBTC(),
}
@ -2413,7 +2413,7 @@ func handleGetMiningInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{
HashesPerSec: s.cfg.CPUMiner.HashesPerSecond(),
NetworkHashPS: networkHashesPerSec,
PooledTx: uint64(s.cfg.TxMemPool.Count()),
TestNet: cfg.TestNet3,
TestNet: cfg.TestNet3 || cfg.TestNet4,
}
return &result, nil
}