diff --git a/README.md b/README.md index 2a785603..73ef4be0 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,12 @@ To override history_max in websocket config, use the path with "_" as a path del BHS_HISTORY_MAX=300 ``` +To connect BHS to Testnet, you can use the following environment variable: + +```bash +BHS_P2P_CHAIN_NET_TYPE=testnet +```` +
diff --git a/config/load.go b/config/load.go index 611160d4..5c36606e 100644 --- a/config/load.go +++ b/config/load.go @@ -35,6 +35,14 @@ func Load(cfg *AppConfig) (*AppConfig, *zerolog.Logger, error) { } setP2PLogger(logger) + + // Update ActiveNetParams based on the loaded configuration + if cfg.P2P != nil { + ActiveNetParams = cfg.P2P.GetNetParams() + // Update checkpoints to use the new network params + Checkpoints = ActiveNetParams.Checkpoints + } + return cfg, logger, nil } diff --git a/config/p2p_network_params.go b/config/p2p_network_params.go index aed40db5..59298ea1 100644 --- a/config/p2p_network_params.go +++ b/config/p2p_network_params.go @@ -35,6 +35,7 @@ func (c *P2PConfig) GetNetParams() *chaincfg.Params { } // ActiveNetParams is a pointer to the parameters specific to the -// currently active bitcoin network. +// currently active bitcoin network. This is initialized to MainNet +// but will be updated based on the P2P config when the configuration is loaded. // TODO: remove this after switching to new p2p server. var ActiveNetParams = &chaincfg.MainNetParams diff --git a/internal/chaincfg/params.go b/internal/chaincfg/params.go index f7919c28..bdb73b04 100644 --- a/internal/chaincfg/params.go +++ b/internal/chaincfg/params.go @@ -224,7 +224,9 @@ var MainNetParams = Params{ Net: wire.MainNet, DefaultPort: "8333", DNSSeeds: []DNSSeed{ - {"seed-nodes.bsvb.tech", true}, + {"seed.bitcoinsv.io", true}, + {"seed.satoshisvision.network", true}, + {"seed.bitcoinseed.directory", true}, }, // Chain parameters @@ -367,8 +369,9 @@ var TestNet3Params = Params{ Net: wire.TestNet3, DefaultPort: "18333", DNSSeeds: []DNSSeed{ - {"testnet-seed.metasv.io", true}, - {"testnet-btccash-seeder.bitcoinunlimited.info", true}, + {"testnet-seed.bitcoinsv.io", true}, + {"testnet-seed.bitcoincloud.net", true}, + {"testnet-seed.bitcoinseed.directory", true}, }, // Chain parameters diff --git a/internal/chaincfg/params_test.go b/internal/chaincfg/params_test.go index 13e73c8d..4ba13e56 100644 --- a/internal/chaincfg/params_test.go +++ b/internal/chaincfg/params_test.go @@ -37,7 +37,9 @@ func TestMustRegisterPanic(t *testing.T) { // TestSeeds ensures the right seeds are defined. func TestSeeds(t *testing.T) { expectedSeeds := []DNSSeed{ - {"seed-nodes.bsvb.tech", true}, + {"seed.bitcoinsv.io", true}, + {"seed.satoshisvision.network", true}, + {"seed.bitcoinseed.directory", true}, } if MainNetParams.DNSSeeds == nil {