lbcd/params.go

93 lines
3.1 KiB
Go
Raw Normal View History

2014-01-01 17:16:15 +01:00
// Copyright (c) 2013-2014 Conformal Systems LLC.
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 (
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/wire"
2013-08-06 23:55:22 +02:00
)
// activeNetParams is a pointer to the parameters specific to the
// currently active bitcoin network.
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 {
*chaincfg.Params
rpcPort string
dnsSeeds []string
2013-08-06 23:55:22 +02:00
}
// mainNetParams contains parameters specific to the main network
// (wire.MainNet). NOTE: The RPC port is intentionally different than the
// 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{
Params: &chaincfg.MainNetParams,
rpcPort: "8334",
2013-08-06 23:55:22 +02:00
dnsSeeds: []string{
"seed.bitcoin.sipa.be",
"dnsseed.bluematt.me",
"dnsseed.bitcoin.dashjr.org",
2014-01-05 05:20:06 +01:00
"seed.bitcoinstats.com",
2014-04-01 20:58:40 +02:00
"seed.bitnodes.io",
2013-08-06 23:55:22 +02:00
"bitseed.xf2.org",
"seeds.bitcoin.open-nodes.org",
2013-08-06 23:55:22 +02:00
},
}
// regressionNetParams contains parameters specific to the regression test
// network (wire.TestNet). NOTE: The RPC port is intentionally different
// than the reference implementation - see the mainNetParams comment for
// details.
var regressionNetParams = params{
Params: &chaincfg.RegressionNetParams,
rpcPort: "18334",
dnsSeeds: []string{},
2013-08-06 23:55:22 +02:00
}
// 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.
2013-08-06 23:55:22 +02:00
var testNet3Params = params{
Params: &chaincfg.TestNet3Params,
rpcPort: "18334",
2013-08-06 23:55:22 +02:00
dnsSeeds: []string{
"testnet-seed.alexykot.me",
"testnet-seed.bitcoin.schildbach.de",
2013-08-06 23:55:22 +02:00
"testnet-seed.bitcoin.petertodd.org",
"testnet-seed.bluematt.me",
},
}
// simNetParams contains parameters specific to the simulation test network
// (wire.SimNet).
var simNetParams = params{
Params: &chaincfg.SimNetParams,
rpcPort: "18556",
dnsSeeds: []string{}, // NOTE: There must NOT be any seeds.
}
// 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
// chaincfg parameters. This function can be used to override this directory
// name as "testnet" when the passed active network matches wire.TestNet3.
//
// 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.
func netName(chainParams *params) string {
switch chainParams.Net {
case wire.TestNet3:
return "testnet"
2013-08-06 23:55:22 +02:00
default:
return chainParams.Name
2013-08-06 23:55:22 +02:00
}
}