github.com/dashpay/godash@v0.0.0-20160726055534-e038a21e0e3d/params.go (about) 1 // Copyright (c) 2013-2016 The btcsuite developers 2 // Copyright (c) 2016 The Dash 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/dashpay/godash/chaincfg" 10 "github.com/dashpay/godash/wire" 11 ) 12 13 // activeNetParams is a pointer to the parameters specific to the 14 // currently active bitcoin 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 rpcPort 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 btcd 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 btcd. This approach allows the wallet process 29 // to emulate the full reference implementation RPC API. 30 var mainNetParams = params{ 31 Params: &chaincfg.MainNetParams, 32 rpcPort: "8334", 33 } 34 35 // regressionNetParams contains parameters specific to the regression test 36 // network (wire.TestNet). NOTE: The RPC port is intentionally different 37 // than the reference implementation - see the mainNetParams comment for 38 // details. 39 var regressionNetParams = params{ 40 Params: &chaincfg.RegressionNetParams, 41 rpcPort: "18334", 42 } 43 44 // testNet3Params contains parameters specific to the test network (version 3) 45 // (wire.TestNet3). NOTE: The RPC port is intentionally different than the 46 // reference implementation - see the mainNetParams comment for details. 47 var testNet3Params = params{ 48 Params: &chaincfg.TestNet3Params, 49 rpcPort: "18334", 50 } 51 52 // simNetParams contains parameters specific to the simulation test network 53 // (wire.SimNet). 54 var simNetParams = params{ 55 Params: &chaincfg.SimNetParams, 56 rpcPort: "18556", 57 } 58 59 // netName returns the name used when referring to a bitcoin network. At the 60 // time of writing, btcd currently places blocks for testnet version 3 in the 61 // data and log directory "testnet", which does not match the Name field of the 62 // chaincfg parameters. This function can be used to override this directory 63 // name as "testnet" when the passed active network matches wire.TestNet3. 64 // 65 // A proper upgrade to move the data and log directories for this network to 66 // "testnet3" is planned for the future, at which point this function can be 67 // removed and the network parameter's name used instead. 68 func netName(chainParams *params) string { 69 switch chainParams.Net { 70 case wire.TestNet3: 71 return "testnet" 72 default: 73 return chainParams.Name 74 } 75 }