Skip to content

Commit

Permalink
Sprinkle more TestNet4
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopeereboom committed Nov 7, 2024
1 parent 2cbe0a0 commit 3b0fc23
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 7 additions & 1 deletion cmd/addblock/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
"os"
"path/filepath"

flags "github.com/jessevdk/go-flags"

"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/database"
_ "github.com/btcsuite/btcd/database/ffldb"
"github.com/btcsuite/btcd/wire"
flags "github.com/jessevdk/go-flags"
)

const (
Expand Down Expand Up @@ -42,6 +43,7 @@ type config struct {
RegressionTest bool `long:"regtest" description:"Use the regression test network"`
SimNet bool `long:"simnet" description:"Use the simulation test network"`
TestNet3 bool `long:"testnet" description:"Use the test network"`
TestNet4 bool `long:"testnet4" description:"Use the test network"`
TxIndex bool `long:"txindex" description:"Build a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC"`
}

Expand Down Expand Up @@ -113,6 +115,10 @@ func loadConfig() (*config, []string, error) {
numNets++
activeNetParams = &chaincfg.TestNet3Params
}
if cfg.TestNet4 {
numNets++
activeNetParams = &chaincfg.TestNet4Params
}
if cfg.RegressionTest {
numNets++
activeNetParams = &chaincfg.RegressionNetParams
Expand Down
18 changes: 15 additions & 3 deletions cmd/btcctl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"regexp"
"strings"

flags "github.com/jessevdk/go-flags"

"github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
flags "github.com/jessevdk/go-flags"
)

const (
Expand Down Expand Up @@ -107,6 +108,7 @@ type config struct {
SimNet bool `long:"simnet" description:"Connect to the simulation test network"`
TLSSkipVerify bool `long:"skipverify" description:"Do not verify tls certificates (not recommended!)"`
TestNet3 bool `long:"testnet" description:"Connect to testnet"`
TestNet4 bool `long:"testnet4" description:"Connect to testnet"`
SigNet bool `long:"signet" description:"Connect to signet"`
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
Wallet bool `long:"wallet" description:"Connect to wallet"`
Expand All @@ -125,6 +127,12 @@ func normalizeAddress(addr string, chain *chaincfg.Params, useWallet bool) (stri
} else {
defaultPort = "18334"
}
case &chaincfg.TestNet4Params:
if useWallet {
defaultPort = "48332"
} else {
defaultPort = "48334"
}
case &chaincfg.SimNetParams:
if useWallet {
defaultPort = "18554"
Expand Down Expand Up @@ -272,6 +280,10 @@ func loadConfig() (*config, []string, error) {
numNets++
network = &chaincfg.TestNet3Params
}
if cfg.TestNet4 {
numNets++
network = &chaincfg.TestNet4Params
}
if cfg.SimNet {
numNets++
network = &chaincfg.SimNetParams
Expand Down Expand Up @@ -348,14 +360,14 @@ func createDefaultConfigFile(destinationPath, serverConfigPath string) error {
noTLSSubmatches := noTLSRegexp.FindSubmatch(content)

// Create the destination directory if it does not exists
err = os.MkdirAll(filepath.Dir(destinationPath), 0700)
err = os.MkdirAll(filepath.Dir(destinationPath), 0o700)
if err != nil {
return err
}

// Create the destination file and write the rpcuser and rpcpass to it
dest, err := os.OpenFile(destinationPath,
os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o600)
if err != nil {
return err
}
Expand Down

0 comments on commit 3b0fc23

Please sign in to comment.