Skip to content

Commit

Permalink
switch to bch testnet4
Browse files Browse the repository at this point in the history
site: add bch explorer links
  • Loading branch information
chappjc committed May 15, 2022
1 parent efd7c12 commit 13ed847
Show file tree
Hide file tree
Showing 8 changed files with 818 additions and 32 deletions.
4 changes: 2 additions & 2 deletions client/asset/bch/bch.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
var (
netPorts = dexbtc.NetPorts{
Mainnet: "8332",
Testnet: "18332",
Testnet: "28332",
Simnet: "18443",
}
fallbackFeeKey = "fallbackfee"
Expand Down Expand Up @@ -137,7 +137,7 @@ func NewWallet(cfg *asset.WalletConfig, logger dex.Logger, network dex.Network)
case dex.Mainnet:
params = dexbch.MainNetParams
case dex.Testnet:
params = dexbch.TestNet3Params
params = dexbch.TestNet4Params
case dex.Regtest:
params = dexbch.RegressionNetParams
default:
Expand Down
4 changes: 4 additions & 0 deletions client/webserver/site/src/js/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,9 @@ const CoinExplorers: Record<number, Record<number, (cid: string) => string>> = {
3: { // doge
[Mainnet]: (cid: string) => `https://dogeblocks.com/tx/${cid.split(':')[0]}`,
[Testnet]: (cid: string) => `https://blockexplorer.one/dogecoin/testnet/tx/${cid.split(':')[0]}`
},
145: { // bch
[Mainnet]: (cid: string) => `https://bch.loping.net/tx/${cid.split(':')[0]}`,
[Testnet]: (cid: string) => `https://tbch4.loping.net/tx/${cid.split(':')[0]}`
}
}
4 changes: 2 additions & 2 deletions dex/networks/bch/cashaddr.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func convertParams(btcParams *chaincfg.Params) *bchchaincfg.Params {
switch btcParams.Net {
case MainNetParams.Net:
return &bchchaincfg.MainNetParams
case TestNet3Params.Net:
return &bchchaincfg.TestNet3Params
case TestNet4Params.Net:
return &bchchaincfg.TestNet4Params
case RegressionNetParams.Net:
return &bchchaincfg.RegressionNetParams
}
Expand Down
2 changes: 1 addition & 1 deletion dex/networks/bch/cashaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestCashAddr(t *testing.T) {

}

nets := []*chaincfg.Params{MainNetParams, TestNet3Params, RegressionNetParams}
nets := []*chaincfg.Params{MainNetParams, TestNet4Params, RegressionNetParams}
for _, net := range nets {
// Check the lowest and highest possible hashes.
checkHash(net, lowB)
Expand Down
10 changes: 5 additions & 5 deletions dex/networks/bch/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ var (
CoinbaseMaturity: 100,
Net: 0xe8f3e1e3,
})
// TestNet3Params are the clone parameters for testnet.
TestNet3Params = btc.ReadCloneParams(&btc.CloneParams{
Name: "testnet3",
// TestNet4Params are the clone parameters for testnet4.
TestNet4Params = btc.ReadCloneParams(&btc.CloneParams{
Name: "testnet4",
PubKeyHashAddrID: 0x6f,
ScriptHashAddrID: 0xc4,
Bech32HRPSegwit: "bchtest",
CoinbaseMaturity: 100,
Net: 0xf4f3e5f4,
Net: 0xafdab7e2,
})
// RegressionNetParams are the clone parameters for simnet.
RegressionNetParams = btc.ReadCloneParams(&btc.CloneParams{
Expand All @@ -52,7 +52,7 @@ var (
)

func init() {
for _, params := range []*chaincfg.Params{MainNetParams, TestNet3Params, RegressionNetParams} {
for _, params := range []*chaincfg.Params{MainNetParams, TestNet4Params, RegressionNetParams} {
err := chaincfg.Register(params)
if err != nil {
panic("failed to register bch parameters: " + err.Error())
Expand Down
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
github.com/decred/go-socks v1.1.0
github.com/decred/slog v1.2.0
github.com/ethereum/go-ethereum v1.10.16
github.com/gcash/bchd v0.17.2-0.20201218180520-5708823e0e99
github.com/gcash/bchd v0.19.0
github.com/gcash/bchutil v0.0.0-20210113190856-6ea28dff4000
github.com/go-chi/chi/v5 v5.0.1
github.com/gorilla/websocket v1.5.0
Expand All @@ -48,12 +48,12 @@ require (
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d
golang.org/x/text v0.3.6
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
gopkg.in/ini.v1 v1.55.0
gopkg.in/ini.v1 v1.62.0
)

require (
decred.org/cspp/v2 v2.0.0-20211122173608-ee00e4952d5f // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/aead/siphash v1.0.1 // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
Expand All @@ -74,7 +74,7 @@ require (
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/gcash/bchlog v0.0.0-20180913005452-b4f036f92fa6 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.1.5 // indirect
Expand All @@ -93,12 +93,13 @@ require (
github.com/lightningnetwork/lnd/ticker v1.0.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-runewidth v0.0.12 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
Expand Down
Loading

0 comments on commit 13ed847

Please sign in to comment.