2016-01-07 17:01:51 +01:00
|
|
|
// Copyright (c) 2013-2016 The btcsuite developers
|
2013-08-06 23:55:22 +02:00
|
|
|
// Use of this source code is governed by an ISC
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-10-15 07:45:32 +02:00
|
|
|
"github.com/lbryio/lbcd/chaincfg"
|
|
|
|
"github.com/lbryio/lbcd/wire"
|
2013-08-06 23:55:22 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// activeNetParams is a pointer to the parameters specific to the
|
|
|
|
// currently active bitcoin network.
|
2014-05-23 06:14:36 +02:00
|
|
|
var activeNetParams = &mainNetParams
|
2013-08-06 23:55:22 +02:00
|
|
|
|
|
|
|
// params is used to group parameters for various networks such as the main
|
|
|
|
// network and test networks.
|
|
|
|
type params struct {
|
2015-02-06 06:18:27 +01:00
|
|
|
*chaincfg.Params
|
2015-11-09 23:21:16 +01:00
|
|
|
rpcPort string
|
2013-08-06 23:55:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// mainNetParams contains parameters specific to the main network
|
2015-02-05 22:16:39 +01:00
|
|
|
// (wire.MainNet). NOTE: The RPC port is intentionally different than the
|
2013-10-16 22:01:43 +02:00
|
|
|
// reference implementation because btcd does not handle wallet requests. The
|
|
|
|
// separate wallet process listens on the well-known port and forwards requests
|
|
|
|
// it does not handle on to btcd. This approach allows the wallet process
|
|
|
|
// to emulate the full reference implementation RPC API.
|
2013-08-06 23:55:22 +02:00
|
|
|
var mainNetParams = params{
|
2015-02-06 06:18:27 +01:00
|
|
|
Params: &chaincfg.MainNetParams,
|
2018-08-15 02:59:48 +02:00
|
|
|
rpcPort: "9245",
|
|
|
|
}
|
|
|
|
|
|
|
|
// testNet3Params contains parameters specific to the test network (version 3)
|
|
|
|
// (wire.TestNet3). NOTE: The RPC port is intentionally different than the
|
|
|
|
// reference implementation - see the mainNetParams comment for details.
|
|
|
|
var testNet3Params = params{
|
|
|
|
Params: &chaincfg.TestNet3Params,
|
|
|
|
rpcPort: "19245",
|
2013-08-06 23:55:22 +02:00
|
|
|
}
|
|
|
|
|
2014-05-23 06:14:36 +02:00
|
|
|
// regressionNetParams contains parameters specific to the regression test
|
2015-02-05 22:16:39 +01:00
|
|
|
// network (wire.TestNet). NOTE: The RPC port is intentionally different
|
2014-05-23 06:14:36 +02:00
|
|
|
// than the reference implementation - see the mainNetParams comment for
|
|
|
|
// details.
|
|
|
|
var regressionNetParams = params{
|
2015-11-09 23:21:16 +01:00
|
|
|
Params: &chaincfg.RegressionNetParams,
|
2018-08-15 02:59:48 +02:00
|
|
|
rpcPort: "29245",
|
2013-08-06 23:55:22 +02:00
|
|
|
}
|
|
|
|
|
2014-05-28 22:19:38 +02:00
|
|
|
// simNetParams contains parameters specific to the simulation test network
|
2015-02-05 22:16:39 +01:00
|
|
|
// (wire.SimNet).
|
2014-05-28 22:19:38 +02:00
|
|
|
var simNetParams = params{
|
2015-11-09 23:21:16 +01:00
|
|
|
Params: &chaincfg.SimNetParams,
|
2018-08-15 02:59:48 +02:00
|
|
|
rpcPort: "39245",
|
2014-05-28 22:19:38 +02:00
|
|
|
}
|
|
|
|
|
2021-02-14 15:49:11 +01:00
|
|
|
// sigNetParams contains parameters specific to the Signet network
|
|
|
|
// (wire.SigNet).
|
|
|
|
var sigNetParams = params{
|
|
|
|
Params: &chaincfg.SigNetParams,
|
2018-08-15 02:59:48 +02:00
|
|
|
rpcPort: "49245",
|
2021-02-14 15:49:11 +01:00
|
|
|
}
|
|
|
|
|
2014-05-23 06:14:36 +02:00
|
|
|
// netName returns the name used when referring to a bitcoin network. At the
|
|
|
|
// time of writing, btcd currently places blocks for testnet version 3 in the
|
|
|
|
// data and log directory "testnet", which does not match the Name field of the
|
2015-02-06 06:18:27 +01:00
|
|
|
// chaincfg parameters. This function can be used to override this directory
|
|
|
|
// name as "testnet" when the passed active network matches wire.TestNet3.
|
2014-05-23 06:14:36 +02:00
|
|
|
//
|
|
|
|
// A proper upgrade to move the data and log directories for this network to
|
|
|
|
// "testnet3" is planned for the future, at which point this function can be
|
|
|
|
// removed and the network parameter's name used instead.
|
2015-02-06 06:18:27 +01:00
|
|
|
func netName(chainParams *params) string {
|
|
|
|
switch chainParams.Net {
|
2015-02-05 22:16:39 +01:00
|
|
|
case wire.TestNet3:
|
2014-05-23 06:14:36 +02:00
|
|
|
return "testnet"
|
2013-08-06 23:55:22 +02:00
|
|
|
default:
|
2015-02-06 06:18:27 +01:00
|
|
|
return chainParams.Name
|
2013-08-06 23:55:22 +02:00
|
|
|
}
|
|
|
|
}
|