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