github.com/decred/dcrlnd@v0.7.6/chainreg/chainparams.go (about)

     1  package chainreg
     2  
     3  import (
     4  	"github.com/decred/dcrd/chaincfg/v3"
     5  	"github.com/decred/dcrd/wire"
     6  	"github.com/decred/dcrlnd/keychain"
     7  )
     8  
     9  // DecredNetParams couples the p2p parameters of a network with the
    10  // corresponding RPC port of a daemon running on the particular network.
    11  type DecredNetParams struct {
    12  	*chaincfg.Params
    13  	RPCPort  string
    14  	CoinType uint32
    15  	DcrwPort string
    16  }
    17  
    18  // decredTestNetParams contains parameters specific to the 3rd version of the
    19  // test network.
    20  var DecredTestNetParams = DecredNetParams{
    21  	Params:   chaincfg.TestNet3Params(),
    22  	RPCPort:  "19109",
    23  	CoinType: keychain.CoinTypeTestnet,
    24  	DcrwPort: "19111",
    25  }
    26  
    27  // DecredMainNetParams contains parameters specific to the current Decred
    28  // mainnet.
    29  var DecredMainNetParams = DecredNetParams{
    30  	Params:   chaincfg.MainNetParams(),
    31  	RPCPort:  "9109",
    32  	CoinType: keychain.CoinTypeDecred,
    33  	DcrwPort: "9111",
    34  }
    35  
    36  // decredSimNetParams contains parameters specific to the simulation test
    37  // network.
    38  var DecredSimNetParams = DecredNetParams{
    39  	Params:   chaincfg.SimNetParams(),
    40  	RPCPort:  "19556",
    41  	CoinType: keychain.CoinTypeTestnet,
    42  	DcrwPort: "19558",
    43  }
    44  
    45  // regTestNetParams contains parameters specific to a local regtest network.
    46  var RegTestNetParams = DecredNetParams{
    47  	Params:   chaincfg.RegNetParams(),
    48  	RPCPort:  "19334",
    49  	CoinType: keychain.CoinTypeTestnet,
    50  }
    51  
    52  // IsTestnet tests if the given params correspond to a testnet
    53  // parameter configuration.
    54  func IsTestnet(params *DecredNetParams) bool {
    55  	switch params.Params.Net {
    56  	case wire.TestNet3:
    57  		return true
    58  	default:
    59  		return false
    60  	}
    61  }