Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
````


<!-- PROJECT LOGO -->
<br />
Expand Down
8 changes: 8 additions & 0 deletions config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 2 additions & 1 deletion config/p2p_network_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 6 additions & 3 deletions internal/chaincfg/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion internal/chaincfg/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading