[lbry] align port settings between lbcd, lbcctl, and lbcwallet
This commit is contained in:
parent
68369ba937
commit
ca6243fbd0
21 changed files with 146 additions and 149 deletions
|
@ -11,8 +11,8 @@
|
|||
# For more information how to use this docker image visit:
|
||||
# https://github.com/btcsuite/btcd/tree/master/docs
|
||||
#
|
||||
# 8333 Mainnet Bitcoin peer-to-peer port
|
||||
# 8334 Mainet RPC port
|
||||
# 9246 Mainnet Bitcoin peer-to-peer port
|
||||
# 9245 Mainet RPC port
|
||||
|
||||
ARG ARCH=amd64
|
||||
# using the SHA256 instead of tags
|
||||
|
|
|
@ -34,61 +34,61 @@ var someIP = "173.194.115.66"
|
|||
func addNaTests() {
|
||||
// IPv4
|
||||
// Localhost
|
||||
addNaTest("127.0.0.1", 8333, "127.0.0.1:8333")
|
||||
addNaTest("127.0.0.1", 8334, "127.0.0.1:8334")
|
||||
addNaTest("127.0.0.1", 9244, "127.0.0.1:9244")
|
||||
addNaTest("127.0.0.1", 9245, "127.0.0.1:9245")
|
||||
|
||||
// Class A
|
||||
addNaTest("1.0.0.1", 8333, "1.0.0.1:8333")
|
||||
addNaTest("2.2.2.2", 8334, "2.2.2.2:8334")
|
||||
addNaTest("27.253.252.251", 8335, "27.253.252.251:8335")
|
||||
addNaTest("123.3.2.1", 8336, "123.3.2.1:8336")
|
||||
addNaTest("1.0.0.1", 9244, "1.0.0.1:9244")
|
||||
addNaTest("2.2.2.2", 9245, "2.2.2.2:9245")
|
||||
addNaTest("27.253.252.251", 9246, "27.253.252.251:9246")
|
||||
addNaTest("123.3.2.1", 9247, "123.3.2.1:9247")
|
||||
|
||||
// Private Class A
|
||||
addNaTest("10.0.0.1", 8333, "10.0.0.1:8333")
|
||||
addNaTest("10.1.1.1", 8334, "10.1.1.1:8334")
|
||||
addNaTest("10.2.2.2", 8335, "10.2.2.2:8335")
|
||||
addNaTest("10.10.10.10", 8336, "10.10.10.10:8336")
|
||||
addNaTest("10.0.0.1", 9244, "10.0.0.1:9244")
|
||||
addNaTest("10.1.1.1", 9245, "10.1.1.1:9245")
|
||||
addNaTest("10.2.2.2", 9246, "10.2.2.2:9246")
|
||||
addNaTest("10.10.10.10", 9247, "10.10.10.10:9247")
|
||||
|
||||
// Class B
|
||||
addNaTest("128.0.0.1", 8333, "128.0.0.1:8333")
|
||||
addNaTest("129.1.1.1", 8334, "129.1.1.1:8334")
|
||||
addNaTest("180.2.2.2", 8335, "180.2.2.2:8335")
|
||||
addNaTest("191.10.10.10", 8336, "191.10.10.10:8336")
|
||||
addNaTest("128.0.0.1", 9244, "128.0.0.1:9244")
|
||||
addNaTest("129.1.1.1", 9245, "129.1.1.1:9245")
|
||||
addNaTest("180.2.2.2", 9246, "180.2.2.2:9246")
|
||||
addNaTest("191.10.10.10", 9247, "191.10.10.10:9247")
|
||||
|
||||
// Private Class B
|
||||
addNaTest("172.16.0.1", 8333, "172.16.0.1:8333")
|
||||
addNaTest("172.16.1.1", 8334, "172.16.1.1:8334")
|
||||
addNaTest("172.16.2.2", 8335, "172.16.2.2:8335")
|
||||
addNaTest("172.16.172.172", 8336, "172.16.172.172:8336")
|
||||
addNaTest("172.16.0.1", 9244, "172.16.0.1:9244")
|
||||
addNaTest("172.16.1.1", 9245, "172.16.1.1:9245")
|
||||
addNaTest("172.16.2.2", 9246, "172.16.2.2:9246")
|
||||
addNaTest("172.16.172.172", 9247, "172.16.172.172:9247")
|
||||
|
||||
// Class C
|
||||
addNaTest("193.0.0.1", 8333, "193.0.0.1:8333")
|
||||
addNaTest("200.1.1.1", 8334, "200.1.1.1:8334")
|
||||
addNaTest("205.2.2.2", 8335, "205.2.2.2:8335")
|
||||
addNaTest("223.10.10.10", 8336, "223.10.10.10:8336")
|
||||
addNaTest("193.0.0.1", 9244, "193.0.0.1:9244")
|
||||
addNaTest("200.1.1.1", 9245, "200.1.1.1:9245")
|
||||
addNaTest("205.2.2.2", 9246, "205.2.2.2:9246")
|
||||
addNaTest("223.10.10.10", 9247, "223.10.10.10:9247")
|
||||
|
||||
// Private Class C
|
||||
addNaTest("192.168.0.1", 8333, "192.168.0.1:8333")
|
||||
addNaTest("192.168.1.1", 8334, "192.168.1.1:8334")
|
||||
addNaTest("192.168.2.2", 8335, "192.168.2.2:8335")
|
||||
addNaTest("192.168.192.192", 8336, "192.168.192.192:8336")
|
||||
addNaTest("192.168.0.1", 9244, "192.168.0.1:9244")
|
||||
addNaTest("192.168.1.1", 9245, "192.168.1.1:9245")
|
||||
addNaTest("192.168.2.2", 9246, "192.168.2.2:9246")
|
||||
addNaTest("192.168.192.192", 9247, "192.168.192.192:9247")
|
||||
|
||||
// IPv6
|
||||
// Localhost
|
||||
addNaTest("::1", 8333, "[::1]:8333")
|
||||
addNaTest("fe80::1", 8334, "[fe80::1]:8334")
|
||||
addNaTest("::1", 9244, "[::1]:9244")
|
||||
addNaTest("fe80::1", 9245, "[fe80::1]:9245")
|
||||
|
||||
// Link-local
|
||||
addNaTest("fe80::1:1", 8333, "[fe80::1:1]:8333")
|
||||
addNaTest("fe91::2:2", 8334, "[fe91::2:2]:8334")
|
||||
addNaTest("fea2::3:3", 8335, "[fea2::3:3]:8335")
|
||||
addNaTest("feb3::4:4", 8336, "[feb3::4:4]:8336")
|
||||
addNaTest("fe80::1:1", 9244, "[fe80::1:1]:9244")
|
||||
addNaTest("fe91::2:2", 9245, "[fe91::2:2]:9245")
|
||||
addNaTest("fea2::3:3", 9246, "[fea2::3:3]:9246")
|
||||
addNaTest("feb3::4:4", 9247, "[feb3::4:4]:9247")
|
||||
|
||||
// Site-local
|
||||
addNaTest("fec0::1:1", 8333, "[fec0::1:1]:8333")
|
||||
addNaTest("fed1::2:2", 8334, "[fed1::2:2]:8334")
|
||||
addNaTest("fee2::3:3", 8335, "[fee2::3:3]:8335")
|
||||
addNaTest("fef3::4:4", 8336, "[fef3::4:4]:8336")
|
||||
addNaTest("fec0::1:1", 9244, "[fec0::1:1]:9244")
|
||||
addNaTest("fed1::2:2", 9245, "[fed1::2:2]:9245")
|
||||
addNaTest("fee2::3:3", 9246, "[fee2::3:3]:9246")
|
||||
addNaTest("fef3::4:4", 9247, "[fef3::4:4]:9247")
|
||||
}
|
||||
|
||||
func addNaTest(ip string, port uint16, want string) {
|
||||
|
@ -119,7 +119,7 @@ func TestAddAddressByIP(t *testing.T) {
|
|||
err error
|
||||
}{
|
||||
{
|
||||
someIP + ":8333",
|
||||
someIP + ":9244",
|
||||
nil,
|
||||
},
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ func TestAddAddressByIP(t *testing.T) {
|
|||
addrErr,
|
||||
},
|
||||
{
|
||||
someIP[:12] + ":8333",
|
||||
someIP[:12] + ":9244",
|
||||
fmtErr,
|
||||
},
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ func TestAttempt(t *testing.T) {
|
|||
n := addrmgr.New("testattempt", lookupFunc)
|
||||
|
||||
// Add a new address and get it
|
||||
err := n.AddAddressByIP(someIP + ":8333")
|
||||
err := n.AddAddressByIP(someIP + ":9244")
|
||||
if err != nil {
|
||||
t.Fatalf("Adding address failed: %v", err)
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ func TestConnected(t *testing.T) {
|
|||
n := addrmgr.New("testconnected", lookupFunc)
|
||||
|
||||
// Add a new address and get it
|
||||
err := n.AddAddressByIP(someIP + ":8333")
|
||||
err := n.AddAddressByIP(someIP + ":9244")
|
||||
if err != nil {
|
||||
t.Fatalf("Adding address failed: %v", err)
|
||||
}
|
||||
|
@ -261,14 +261,14 @@ func TestNeedMoreAddresses(t *testing.T) {
|
|||
|
||||
var err error
|
||||
for i := 0; i < addrsToAdd; i++ {
|
||||
s := fmt.Sprintf("%d.%d.173.147:8333", i/128+60, i%128+60)
|
||||
s := fmt.Sprintf("%d.%d.173.147:9244", i/128+60, i%128+60)
|
||||
addrs[i], err = n.DeserializeNetAddress(s, wire.SFNodeNetwork)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to turn %s into an address: %v", s, err)
|
||||
}
|
||||
}
|
||||
|
||||
srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
|
||||
srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 9244, 0)
|
||||
|
||||
n.AddAddresses(addrs, srcAddr)
|
||||
numAddrs := n.NumAddresses()
|
||||
|
@ -289,14 +289,14 @@ func TestGood(t *testing.T) {
|
|||
|
||||
var err error
|
||||
for i := 0; i < addrsToAdd; i++ {
|
||||
s := fmt.Sprintf("%d.173.147.%d:8333", i/64+60, i%64+60)
|
||||
s := fmt.Sprintf("%d.173.147.%d:9244", i/64+60, i%64+60)
|
||||
addrs[i], err = n.DeserializeNetAddress(s, wire.SFNodeNetwork)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to turn %s into an address: %v", s, err)
|
||||
}
|
||||
}
|
||||
|
||||
srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
|
||||
srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 9244, 0)
|
||||
|
||||
n.AddAddresses(addrs, srcAddr)
|
||||
for _, addr := range addrs {
|
||||
|
@ -323,7 +323,7 @@ func TestGetAddress(t *testing.T) {
|
|||
}
|
||||
|
||||
// Add a new address and get it
|
||||
err := n.AddAddressByIP(someIP + ":8333")
|
||||
err := n.AddAddressByIP(someIP + ":9244")
|
||||
if err != nil {
|
||||
t.Fatalf("Adding address failed: %v", err)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ func TestIPTypes(t *testing.T) {
|
|||
rfc4193, rfc4380, rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598,
|
||||
local, valid, routable bool) ipTest {
|
||||
nip := net.ParseIP(ip)
|
||||
na := *wire.NewNetAddressIPPort(nip, 8333, wire.SFNodeNetwork)
|
||||
na := *wire.NewNetAddressIPPort(nip, 9246, wire.SFNodeNetwork)
|
||||
test := ipTest{na, rfc1918, rfc2544, rfc3849, rfc3927, rfc3964, rfc4193, rfc4380,
|
||||
rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598, local, valid, routable}
|
||||
return test
|
||||
|
@ -192,7 +192,7 @@ func TestGroupKey(t *testing.T) {
|
|||
|
||||
for i, test := range tests {
|
||||
nip := net.ParseIP(test.ip)
|
||||
na := *wire.NewNetAddressIPPort(nip, 8333, wire.SFNodeNetwork)
|
||||
na := *wire.NewNetAddressIPPort(nip, 9246, wire.SFNodeNetwork)
|
||||
if key := addrmgr.GroupKey(&na); key != test.expected {
|
||||
t.Errorf("TestGroupKey #%d (%s): unexpected group key "+
|
||||
"- got '%s', want '%s'", i, test.name,
|
||||
|
|
|
@ -62,7 +62,7 @@ var (
|
|||
DefaultSignetDNSSeeds = []DNSSeed{
|
||||
{"178.128.221.177", false},
|
||||
{"2a01:7c8:d005:390::5", false},
|
||||
{"v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333", false},
|
||||
{"v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:39246", false},
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -522,7 +522,7 @@ var TestNet3Params = Params{
|
|||
var SimNetParams = Params{
|
||||
Name: "simnet",
|
||||
Net: wire.SimNet,
|
||||
DefaultPort: "18555",
|
||||
DefaultPort: "39246",
|
||||
DNSSeeds: []DNSSeed{}, // NOTE: There must NOT be any seeds.
|
||||
|
||||
// Chain parameters
|
||||
|
@ -615,7 +615,7 @@ func CustomSignetParams(challenge []byte, dnsSeeds []DNSSeed) Params {
|
|||
return Params{
|
||||
Name: "signet",
|
||||
Net: wire.BitcoinNet(net),
|
||||
DefaultPort: "38333",
|
||||
DefaultPort: "39246",
|
||||
DNSSeeds: dnsSeeds,
|
||||
|
||||
// Chain parameters
|
||||
|
|
|
@ -96,20 +96,20 @@ type config struct {
|
|||
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
|
||||
ListCommands bool `short:"l" long:"listcommands" description:"List all of the supported commands and exit"`
|
||||
NoTLS bool `long:"notls" description:"Disable TLS"`
|
||||
TLSSkipVerify bool `long:"skipverify" description:"Do not verify tls certificates (not recommended!)"`
|
||||
Proxy string `long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
|
||||
ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"`
|
||||
ProxyUser string `long:"proxyuser" description:"Username for proxy server"`
|
||||
RegressionTest bool `long:"regtest" description:"Connect to the regression test network"`
|
||||
RPCCert string `short:"c" long:"rpccert" description:"RPC server certificate chain for validation"`
|
||||
RPCPassword string `short:"P" long:"rpcpass" default-mask:"-" description:"RPC password"`
|
||||
RPCServer string `short:"s" long:"rpcserver" description:"RPC server to connect to"`
|
||||
RPCUser string `short:"u" long:"rpcuser" description:"RPC username"`
|
||||
SimNet bool `long:"simnet" description:"Connect to the simulation test network"`
|
||||
TLSSkipVerify bool `long:"skipverify" description:"Do not verify tls certificates (not recommended!)"`
|
||||
TestNet3 bool `long:"testnet" description:"Connect to testnet"`
|
||||
SigNet bool `long:"signet" description:"Connect to signet"`
|
||||
TestNet3 bool `long:"testnet" description:"Connect to testnet (default RPC server: localhost:19245)"`
|
||||
RegressionTest bool `long:"regtest" description:"Connect to the regression test network (default RPC server: localhost:29245)"`
|
||||
SimNet bool `long:"simnet" description:"Connect to the simulation test network (default RPC server: localhost:39245)"`
|
||||
SigNet bool `long:"signet" description:"Connect to signet (default RPC server: localhost:49245)"`
|
||||
Wallet bool `long:"wallet" description:"Connect to wallet RPC server instead (default: localhost:9244, testnet: localhost:19244, regtest: localhost:29244)"`
|
||||
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
|
||||
Wallet bool `long:"wallet" description:"Connect to wallet"`
|
||||
}
|
||||
|
||||
// normalizeAddress returns addr with the passed default port appended if
|
||||
|
@ -121,35 +121,33 @@ func normalizeAddress(addr string, chain *chaincfg.Params, useWallet bool) (stri
|
|||
switch chain {
|
||||
case &chaincfg.TestNet3Params:
|
||||
if useWallet {
|
||||
defaultPort = "18332"
|
||||
defaultPort = "19244"
|
||||
} else {
|
||||
defaultPort = "18334"
|
||||
}
|
||||
case &chaincfg.SimNetParams:
|
||||
if useWallet {
|
||||
defaultPort = "18554"
|
||||
} else {
|
||||
defaultPort = "18556"
|
||||
defaultPort = "19245"
|
||||
}
|
||||
case &chaincfg.RegressionNetParams:
|
||||
if useWallet {
|
||||
// TODO: add port once regtest is supported in btcwallet
|
||||
paramErr := fmt.Errorf("cannot use -wallet with -regtest, btcwallet not yet compatible with regtest")
|
||||
return "", paramErr
|
||||
defaultPort = "29244"
|
||||
} else {
|
||||
defaultPort = "29245"
|
||||
}
|
||||
case &chaincfg.SimNetParams:
|
||||
if useWallet {
|
||||
defaultPort = "39244"
|
||||
} else {
|
||||
defaultPort = "39245"
|
||||
}
|
||||
case &chaincfg.SigNetParams:
|
||||
if useWallet {
|
||||
defaultPort = "38332"
|
||||
defaultPort = "49244"
|
||||
} else {
|
||||
defaultPort = "38332"
|
||||
defaultPort = "49245"
|
||||
}
|
||||
default:
|
||||
if useWallet {
|
||||
defaultPort = "8332"
|
||||
defaultPort = "9244"
|
||||
} else {
|
||||
defaultPort = "8334"
|
||||
defaultPort = "9245"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ type config struct {
|
|||
ExternalIPs []string `long:"externalip" description:"Add an ip to the list of local addresses we claim to listen on to peers"`
|
||||
Generate bool `long:"generate" description:"Generate (mine) bitcoins using the CPU"`
|
||||
FreeTxRelayLimit float64 `long:"limitfreerelay" description:"Limit relay of transactions with no transaction fee to the given amount in thousands of bytes per minute"`
|
||||
Listeners []string `long:"listen" description:"Add an interface/port to listen for connections (default all interfaces port: 8333, testnet: 18333)"`
|
||||
Listeners []string `long:"listen" description:"Add an interface/port to listen for connections (default all interfaces port: 9246, testnet: 19246, regtest: 29246)"`
|
||||
LogDir string `long:"logdir" description:"Directory to log output."`
|
||||
MaxOrphanTxs int `long:"maxorphantx" description:"Max number of orphan transactions to keep in memory"`
|
||||
MaxPeers int `long:"maxpeers" description:"Max number of inbound and outbound peers"`
|
||||
|
@ -153,7 +153,7 @@ type config struct {
|
|||
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
|
||||
RPCLimitPass string `long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"`
|
||||
RPCLimitUser string `long:"rpclimituser" description:"Username for limited RPC connections"`
|
||||
RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 8334, testnet: 18334)"`
|
||||
RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 9245, testnet: 19245, regtest: 29245)"`
|
||||
RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"`
|
||||
RPCMaxConcurrentReqs int `long:"rpcmaxconcurrentreqs" description:"Max number of concurrent RPC requests that may be processed concurrently"`
|
||||
RPCMaxWebsockets int `long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"`
|
||||
|
|
|
@ -617,7 +617,7 @@ func TestListeners(t *testing.T) {
|
|||
// Setup a connection manager with a couple of mock listeners that
|
||||
// notify a channel when they receive mock connections.
|
||||
receivedConns := make(chan net.Conn)
|
||||
listener1 := newMockListener("127.0.0.1:8333")
|
||||
listener1 := newMockListener("127.0.0.1:9246")
|
||||
listener2 := newMockListener("127.0.0.1:9333")
|
||||
listeners := []net.Listener{listener1, listener2}
|
||||
cmgr, err := New(&Config{
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
index.md
|
24
params.go
24
params.go
|
@ -28,7 +28,15 @@ type params struct {
|
|||
// to emulate the full reference implementation RPC API.
|
||||
var mainNetParams = params{
|
||||
Params: &chaincfg.MainNetParams,
|
||||
rpcPort: "8334",
|
||||
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",
|
||||
}
|
||||
|
||||
// regressionNetParams contains parameters specific to the regression test
|
||||
|
@ -37,29 +45,21 @@ var mainNetParams = params{
|
|||
// details.
|
||||
var regressionNetParams = params{
|
||||
Params: &chaincfg.RegressionNetParams,
|
||||
rpcPort: "18334",
|
||||
}
|
||||
|
||||
// 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: "18334",
|
||||
rpcPort: "29245",
|
||||
}
|
||||
|
||||
// simNetParams contains parameters specific to the simulation test network
|
||||
// (wire.SimNet).
|
||||
var simNetParams = params{
|
||||
Params: &chaincfg.SimNetParams,
|
||||
rpcPort: "18556",
|
||||
rpcPort: "39245",
|
||||
}
|
||||
|
||||
// sigNetParams contains parameters specific to the Signet network
|
||||
// (wire.SigNet).
|
||||
var sigNetParams = params{
|
||||
Params: &chaincfg.SigNetParams,
|
||||
rpcPort: "38332",
|
||||
rpcPort: "49245",
|
||||
}
|
||||
|
||||
// netName returns the name used when referring to a bitcoin network. At the
|
||||
|
|
|
@ -290,13 +290,13 @@ func TestPeerConnection(t *testing.T) {
|
|||
"basic handshake",
|
||||
func() (*peer.Peer, *peer.Peer, error) {
|
||||
inConn, outConn := pipe(
|
||||
&conn{raddr: "10.0.0.1:8333"},
|
||||
&conn{raddr: "10.0.0.2:8333"},
|
||||
&conn{raddr: "10.0.0.1:9246"},
|
||||
&conn{raddr: "10.0.0.2:9246"},
|
||||
)
|
||||
inPeer := peer.NewInboundPeer(peer1Cfg)
|
||||
inPeer.AssociateConnection(inConn)
|
||||
|
||||
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:8333")
|
||||
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:9246")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -316,13 +316,13 @@ func TestPeerConnection(t *testing.T) {
|
|||
"socks proxy",
|
||||
func() (*peer.Peer, *peer.Peer, error) {
|
||||
inConn, outConn := pipe(
|
||||
&conn{raddr: "10.0.0.1:8333", proxy: true},
|
||||
&conn{raddr: "10.0.0.2:8333"},
|
||||
&conn{raddr: "10.0.0.1:9246", proxy: true},
|
||||
&conn{raddr: "10.0.0.2:9246"},
|
||||
)
|
||||
inPeer := peer.NewInboundPeer(peer1Cfg)
|
||||
inPeer.AssociateConnection(inConn)
|
||||
|
||||
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:8333")
|
||||
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:9246")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -457,8 +457,8 @@ func TestPeerListeners(t *testing.T) {
|
|||
AllowSelfConns: true,
|
||||
}
|
||||
inConn, outConn := pipe(
|
||||
&conn{raddr: "10.0.0.1:8333"},
|
||||
&conn{raddr: "10.0.0.2:8333"},
|
||||
&conn{raddr: "10.0.0.1:9246"},
|
||||
&conn{raddr: "10.0.0.2:9246"},
|
||||
)
|
||||
inPeer := peer.NewInboundPeer(peerCfg)
|
||||
inPeer.AssociateConnection(inConn)
|
||||
|
@ -468,7 +468,7 @@ func TestPeerListeners(t *testing.T) {
|
|||
verack <- struct{}{}
|
||||
},
|
||||
}
|
||||
outPeer, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
||||
outPeer, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:9246")
|
||||
if err != nil {
|
||||
t.Errorf("NewOutboundPeer: unexpected err %v\n", err)
|
||||
return
|
||||
|
@ -630,9 +630,9 @@ func TestOutboundPeer(t *testing.T) {
|
|||
}
|
||||
|
||||
r, w := io.Pipe()
|
||||
c := &conn{raddr: "10.0.0.1:8333", Writer: w, Reader: r}
|
||||
c := &conn{raddr: "10.0.0.1:9246", Writer: w, Reader: r}
|
||||
|
||||
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
||||
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:9246")
|
||||
if err != nil {
|
||||
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||
return
|
||||
|
@ -687,8 +687,8 @@ func TestOutboundPeer(t *testing.T) {
|
|||
|
||||
peerCfg.NewestBlock = newestBlock
|
||||
r1, w1 := io.Pipe()
|
||||
c1 := &conn{raddr: "10.0.0.1:8333", Writer: w1, Reader: r1}
|
||||
p1, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
||||
c1 := &conn{raddr: "10.0.0.1:9246", Writer: w1, Reader: r1}
|
||||
p1, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:9246")
|
||||
if err != nil {
|
||||
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||
return
|
||||
|
@ -717,8 +717,8 @@ func TestOutboundPeer(t *testing.T) {
|
|||
peerCfg.ChainParams = &chaincfg.RegressionNetParams
|
||||
peerCfg.Services = wire.SFNodeBloom
|
||||
r2, w2 := io.Pipe()
|
||||
c2 := &conn{raddr: "10.0.0.1:8333", Writer: w2, Reader: r2}
|
||||
p2, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
||||
c2 := &conn{raddr: "10.0.0.1:9246", Writer: w2, Reader: r2}
|
||||
p2, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:9246")
|
||||
if err != nil {
|
||||
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||
return
|
||||
|
@ -773,20 +773,20 @@ func TestUnsupportedVersionPeer(t *testing.T) {
|
|||
|
||||
localNA := wire.NewNetAddressIPPort(
|
||||
net.ParseIP("10.0.0.1"),
|
||||
uint16(8333),
|
||||
uint16(9246),
|
||||
wire.SFNodeNetwork,
|
||||
)
|
||||
remoteNA := wire.NewNetAddressIPPort(
|
||||
net.ParseIP("10.0.0.2"),
|
||||
uint16(8333),
|
||||
uint16(9246),
|
||||
wire.SFNodeNetwork,
|
||||
)
|
||||
localConn, remoteConn := pipe(
|
||||
&conn{laddr: "10.0.0.1:8333", raddr: "10.0.0.2:8333"},
|
||||
&conn{laddr: "10.0.0.2:8333", raddr: "10.0.0.1:8333"},
|
||||
&conn{laddr: "10.0.0.1:9246", raddr: "10.0.0.2:9246"},
|
||||
&conn{laddr: "10.0.0.2:9246", raddr: "10.0.0.1:9246"},
|
||||
)
|
||||
|
||||
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333")
|
||||
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:9246")
|
||||
if err != nil {
|
||||
t.Fatalf("NewOutboundPeer: unexpected err - %v\n", err)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
var connCfg = &ConnConfig{
|
||||
Host: "localhost:8332",
|
||||
Host: "localhost:9244",
|
||||
User: "user",
|
||||
Pass: "pass",
|
||||
HTTPPostMode: true,
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
func main() {
|
||||
// Connect to local bitcoin core RPC server using HTTP POST mode.
|
||||
connCfg := &rpcclient.ConnConfig{
|
||||
Host: "localhost:8332",
|
||||
Host: "localhost:9245",
|
||||
User: "yourrpcuser",
|
||||
Pass: "yourrpcpass",
|
||||
HTTPPostMode: true, // Bitcoin core only supports HTTP POST mode
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
func main() {
|
||||
// Connect to local bitcoin core RPC server using HTTP POST mode.
|
||||
connCfg := &rpcclient.ConnConfig{
|
||||
Host: "localhost:8332",
|
||||
Host: "localhost:9245",
|
||||
User: "yourrpcuser",
|
||||
Pass: "yourrpcpass",
|
||||
DisableConnectOnNew: true,
|
||||
|
|
|
@ -38,7 +38,7 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
connCfg := &rpcclient.ConnConfig{
|
||||
Host: "localhost:8334",
|
||||
Host: "localhost:9245",
|
||||
Endpoint: "ws",
|
||||
User: "yourrpcuser",
|
||||
Pass: "yourrpcpass",
|
||||
|
|
|
@ -34,7 +34,7 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
connCfg := &rpcclient.ConnConfig{
|
||||
Host: "localhost:18332",
|
||||
Host: "localhost:19245",
|
||||
Endpoint: "ws",
|
||||
User: "yourrpcuser",
|
||||
Pass: "yourrpcpass",
|
||||
|
|
|
@ -2792,7 +2792,7 @@ func (c *Client) UnloadWalletAsync(walletName *string) FutureUnloadWalletResult
|
|||
}
|
||||
|
||||
// UnloadWallet unloads the referenced wallet. If the RPC server URL already
|
||||
// contains the name of the wallet, like http://127.0.0.1:8332/wallet/<walletname>,
|
||||
// contains the name of the wallet, like http://127.0.0.1:9245/wallet/<walletname>,
|
||||
// the parameter must be nil, or it'll return an error.
|
||||
func (c *Client) UnloadWallet(walletName *string) error {
|
||||
return c.UnloadWalletAsync(walletName).Receive()
|
||||
|
|
|
@ -198,16 +198,16 @@
|
|||
; rpclisten=0.0.0.0
|
||||
; All ipv6 interfaces on default port:
|
||||
; rpclisten=::
|
||||
; All interfaces on port 8334:
|
||||
; rpclisten=:8334
|
||||
; All ipv4 interfaces on port 8334:
|
||||
; rpclisten=0.0.0.0:8334
|
||||
; All ipv6 interfaces on port 8334:
|
||||
; rpclisten=[::]:8334
|
||||
; Only ipv4 localhost on port 8334:
|
||||
; rpclisten=127.0.0.1:8334
|
||||
; Only ipv6 localhost on port 8334:
|
||||
; rpclisten=[::1]:8334
|
||||
; All interfaces on port 9245:
|
||||
; rpclisten=:9245
|
||||
; All ipv4 interfaces on port 9245:
|
||||
; rpclisten=0.0.0.0:9245
|
||||
; All ipv6 interfaces on port 9245:
|
||||
; rpclisten=[::]:9245
|
||||
; Only ipv4 localhost on port 9245:
|
||||
; rpclisten=127.0.0.1:9245
|
||||
; Only ipv6 localhost on port 9245:
|
||||
; rpclisten=[::1]:9245
|
||||
; Only ipv4 localhost on non-standard port 8337:
|
||||
; rpclisten=127.0.0.1:8337
|
||||
; All interfaces on non-standard port 8337:
|
||||
|
|
|
@ -40,10 +40,10 @@ func TestMessage(t *testing.T) {
|
|||
// Create the various types of messages to test.
|
||||
|
||||
// MsgVersion.
|
||||
addrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 8333}
|
||||
addrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 9246}
|
||||
you := NewNetAddress(addrYou, SFNodeNetwork)
|
||||
you.Timestamp = time.Time{} // Version message has zero value timestamp.
|
||||
addrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333}
|
||||
addrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 9246}
|
||||
me := NewNetAddress(addrMe, SFNodeNetwork)
|
||||
me.Timestamp = time.Time{} // Version message has zero value timestamp.
|
||||
msgVersion := NewMsgVersion(me, you, 123123, 0)
|
||||
|
|
|
@ -38,7 +38,7 @@ func TestAddr(t *testing.T) {
|
|||
}
|
||||
|
||||
// Ensure NetAddresses are added properly.
|
||||
tcpAddr := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333}
|
||||
tcpAddr := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 9246}
|
||||
na := NewNetAddress(tcpAddr, SFNodeNetwork)
|
||||
err := msg.AddAddress(na)
|
||||
if err != nil {
|
||||
|
@ -105,7 +105,7 @@ func TestAddrWire(t *testing.T) {
|
|||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
}
|
||||
na2 := &NetAddress{
|
||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||
|
@ -129,7 +129,7 @@ func TestAddrWire(t *testing.T) {
|
|||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
0x29, 0xab, 0x5f, 0x49, // Timestamp
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -216,7 +216,7 @@ func TestAddrWireErrors(t *testing.T) {
|
|||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
}
|
||||
na2 := &NetAddress{
|
||||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||
|
@ -234,7 +234,7 @@ func TestAddrWireErrors(t *testing.T) {
|
|||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
0x29, 0xab, 0x5f, 0x49, // Timestamp
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
|
@ -22,9 +22,9 @@ func TestVersion(t *testing.T) {
|
|||
|
||||
// Create version message data.
|
||||
lastBlock := int32(234234)
|
||||
tcpAddrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333}
|
||||
tcpAddrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 9246}
|
||||
me := NewNetAddress(tcpAddrMe, SFNodeNetwork)
|
||||
tcpAddrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 8333}
|
||||
tcpAddrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 9246}
|
||||
you := NewNetAddress(tcpAddrYou, SFNodeNetwork)
|
||||
nonce, err := RandomUint64()
|
||||
if err != nil {
|
||||
|
@ -377,7 +377,7 @@ func TestVersionOptionalFields(t *testing.T) {
|
|||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("192.168.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
},
|
||||
}
|
||||
onlyRequiredVersionEncoded := make([]byte, len(baseVersionEncoded)-55)
|
||||
|
@ -390,7 +390,7 @@ func TestVersionOptionalFields(t *testing.T) {
|
|||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
}
|
||||
addrMeVersionEncoded := make([]byte, len(baseVersionEncoded)-29)
|
||||
copy(addrMeVersionEncoded, baseVersionEncoded)
|
||||
|
@ -480,13 +480,13 @@ var baseVersion = &MsgVersion{
|
|||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("192.168.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
},
|
||||
AddrMe: NetAddress{
|
||||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
},
|
||||
Nonce: 123123, // 0x1e0f3
|
||||
UserAgent: "/btcdtest:0.0.1/",
|
||||
|
@ -503,12 +503,12 @@ var baseVersionEncoded = []byte{
|
|||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
// AddrMe -- No timestamp for NetAddress in version message
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce
|
||||
0x10, // Varint for user agent length
|
||||
0x2f, 0x62, 0x74, 0x63, 0x64, 0x74, 0x65, 0x73,
|
||||
|
@ -526,13 +526,13 @@ var baseVersionBIP0037 = &MsgVersion{
|
|||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("192.168.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
},
|
||||
AddrMe: NetAddress{
|
||||
Timestamp: time.Time{}, // Zero value -- no timestamp in version
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
},
|
||||
Nonce: 123123, // 0x1e0f3
|
||||
UserAgent: "/btcdtest:0.0.1/",
|
||||
|
@ -549,12 +549,12 @@ var baseVersionBIP0037Encoded = []byte{
|
|||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
// AddrMe -- No timestamp for NetAddress in version message
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce
|
||||
0x10, // Varint for user agent length
|
||||
0x2f, 0x62, 0x74, 0x63, 0x64, 0x74, 0x65, 0x73,
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
// TestNetAddress tests the NetAddress API.
|
||||
func TestNetAddress(t *testing.T) {
|
||||
ip := net.ParseIP("127.0.0.1")
|
||||
port := 8333
|
||||
port := 9246
|
||||
|
||||
// Test NewNetAddress.
|
||||
na := NewNetAddress(&net.TCPAddr{IP: ip, Port: port}, 0)
|
||||
|
@ -79,7 +79,7 @@ func TestNetAddressWire(t *testing.T) {
|
|||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
}
|
||||
|
||||
// baseNetAddrNoTS is baseNetAddr with a zero value for the timestamp.
|
||||
|
@ -92,7 +92,7 @@ func TestNetAddressWire(t *testing.T) {
|
|||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
}
|
||||
|
||||
// baseNetAddrNoTSEncoded is the wire encoded bytes of baseNetAddrNoTS.
|
||||
|
@ -101,7 +101,7 @@ func TestNetAddressWire(t *testing.T) {
|
|||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
|
||||
0x20, 0x8d, // Port 8333 in big-endian
|
||||
0x24, 0x1e, // Port 9246 in big-endian
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
|
@ -211,7 +211,7 @@ func TestNetAddressWireErrors(t *testing.T) {
|
|||
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
|
||||
Services: SFNodeNetwork,
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 8333,
|
||||
Port: 9246,
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
|
|
Loading…
Reference in a new issue