github.com/decred/politeia@v1.4.0/politeiad/params.go (about) 1 // Copyright (c) 2013-2014 The btcsuite developers 2 // Copyright (c) 2015-2017 The Decred developers 3 // Use of this source code is governed by an ISC 4 // license that can be found in the LICENSE file. 5 6 package main 7 8 import ( 9 "github.com/decred/dcrd/chaincfg/v3" 10 "github.com/decred/dcrd/wire" 11 ) 12 13 // activeNetParams is a pointer to the parameters specific to the 14 // currently active decred network. 15 var activeNetParams = &mainNetParams 16 17 // params is used to group parameters for various networks such as the main 18 // network and test networks. 19 type params struct { 20 *chaincfg.Params 21 WalletRPCServerPort string 22 } 23 24 // mainNetParams contains parameters specific to the main network 25 // (wire.MainNet). NOTE: The RPC port is intentionally different than the 26 // reference implementation because dcrd does not handle wallet requests. The 27 // separate wallet process listens on the well-known port and forwards requests 28 // it does not handle on to dcrd. This approach allows the wallet process 29 // to emulate the full reference implementation RPC API. 30 var mainNetParams = params{ 31 Params: chaincfg.MainNetParams(), 32 WalletRPCServerPort: "9111", 33 } 34 35 // testNet3Params contains parameters specific to the test network (version 0) 36 // (wire.TestNet). NOTE: The RPC port is intentionally different than the 37 // reference implementation - see the mainNetParams comment for details. 38 39 var testNet3Params = params{ 40 Params: chaincfg.TestNet3Params(), 41 WalletRPCServerPort: "19111", 42 } 43 44 // simNetParams contains parameters specific to the simulation test network 45 // (wire.SimNet). 46 var simNetParams = params{ 47 Params: chaincfg.SimNetParams(), 48 WalletRPCServerPort: "19558", 49 } 50 51 // netName returns the name used when referring to a decred network. At the 52 // time of writing, dcrd currently places blocks for testnet version 0 in the 53 // data and log directory "testnet", which does not match the Name field of the 54 // chaincfg parameters. This function can be used to override this directory name 55 // as "testnet" when the passed active network matches wire.TestNet. 56 // 57 // A proper upgrade to move the data and log directories for this network to 58 // "testnet" is planned for the future, at which point this function can be 59 // removed and the network parameter's name used instead. 60 func netName(chainParams *params) string { 61 switch chainParams.Net { 62 case wire.TestNet3: 63 return "testnet3" 64 default: 65 return chainParams.Name 66 } 67 }