-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
chainparams.go
60 lines (52 loc) · 1.71 KB
/
chainparams.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package chainreg
import (
bitcoinCfg "github.com/btcsuite/btcd/chaincfg"
bitcoinWire "github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/keychain"
)
// BitcoinNetParams couples the p2p parameters of a network with the
// corresponding RPC port of a daemon running on the particular network.
type BitcoinNetParams struct {
*bitcoinCfg.Params
RPCPort string
CoinType uint32
}
// BitcoinTestNetParams contains parameters specific to the 3rd version of the
// test network.
var BitcoinTestNetParams = BitcoinNetParams{
Params: &bitcoinCfg.TestNet3Params,
RPCPort: "18334",
CoinType: keychain.CoinTypeTestnet,
}
// BitcoinMainNetParams contains parameters specific to the current Bitcoin
// mainnet.
var BitcoinMainNetParams = BitcoinNetParams{
Params: &bitcoinCfg.MainNetParams,
RPCPort: "8334",
CoinType: keychain.CoinTypeBitcoin,
}
// BitcoinSimNetParams contains parameters specific to the simulation test
// network.
var BitcoinSimNetParams = BitcoinNetParams{
Params: &bitcoinCfg.SimNetParams,
RPCPort: "18556",
CoinType: keychain.CoinTypeTestnet,
}
// BitcoinSigNetParams contains parameters specific to the signet test network.
var BitcoinSigNetParams = BitcoinNetParams{
Params: &bitcoinCfg.SigNetParams,
RPCPort: "38332",
CoinType: keychain.CoinTypeTestnet,
}
// BitcoinRegTestNetParams contains parameters specific to a local bitcoin
// regtest network.
var BitcoinRegTestNetParams = BitcoinNetParams{
Params: &bitcoinCfg.RegressionNetParams,
RPCPort: "18334",
CoinType: keychain.CoinTypeTestnet,
}
// IsTestnet tests if the givern params correspond to a testnet
// parameter configuration.
func IsTestnet(params *BitcoinNetParams) bool {
return params.Params.Net == bitcoinWire.TestNet3
}