[NOD-499] Change ports and network magics (#550)

* [NOD-499] Change network magics

* [NOD-499] Change default rpc ports

* [NOD-499] Change default p2p ports

* [NOD-499] Change port 18333 to 10433 everywhere

* [NOD-499] Change port 8333 to 10333 everywhere

* [NOD-499] Fix TestElementWire

* [NOD-499] Fix tests

* [NOD-499] Change port 10333->16111 and 10332->16110

* [NOD-499] Change port 10433->16211 and 10432->16210

* [NOD-499] Change port 10633->16511 and 10632->16510

* [NOD-499] Change port 10533->16611 and 10532->16610
This commit is contained in:
Ori Newman 2019-12-18 16:18:37 +02:00 committed by stasatdaglabs
parent 0d1f447cb7
commit f72afc8bbb
31 changed files with 522 additions and 521 deletions

View File

@ -38,59 +38,59 @@ var someIP = "173.194.115.66"
func addNaTests() { func addNaTests() {
// IPv4 // IPv4
// Localhost // Localhost
addNaTest("127.0.0.1", 8333, "127.0.0.1:8333") addNaTest("127.0.0.1", 16111, "127.0.0.1:16111")
addNaTest("127.0.0.1", 8334, "127.0.0.1:8334") addNaTest("127.0.0.1", 16110, "127.0.0.1:16110")
// Class A // Class A
addNaTest("1.0.0.1", 8333, "1.0.0.1:8333") addNaTest("1.0.0.1", 16111, "1.0.0.1:16111")
addNaTest("2.2.2.2", 8334, "2.2.2.2:8334") addNaTest("2.2.2.2", 16110, "2.2.2.2:16110")
addNaTest("27.253.252.251", 8335, "27.253.252.251:8335") addNaTest("27.253.252.251", 8335, "27.253.252.251:8335")
addNaTest("123.3.2.1", 8336, "123.3.2.1:8336") addNaTest("123.3.2.1", 8336, "123.3.2.1:8336")
// Private Class A // Private Class A
addNaTest("10.0.0.1", 8333, "10.0.0.1:8333") addNaTest("10.0.0.1", 16111, "10.0.0.1:16111")
addNaTest("10.1.1.1", 8334, "10.1.1.1:8334") addNaTest("10.1.1.1", 16110, "10.1.1.1:16110")
addNaTest("10.2.2.2", 8335, "10.2.2.2:8335") addNaTest("10.2.2.2", 8335, "10.2.2.2:8335")
addNaTest("10.10.10.10", 8336, "10.10.10.10:8336") addNaTest("10.10.10.10", 8336, "10.10.10.10:8336")
// Class B // Class B
addNaTest("128.0.0.1", 8333, "128.0.0.1:8333") addNaTest("128.0.0.1", 16111, "128.0.0.1:16111")
addNaTest("129.1.1.1", 8334, "129.1.1.1:8334") addNaTest("129.1.1.1", 16110, "129.1.1.1:16110")
addNaTest("180.2.2.2", 8335, "180.2.2.2:8335") addNaTest("180.2.2.2", 8335, "180.2.2.2:8335")
addNaTest("191.10.10.10", 8336, "191.10.10.10:8336") addNaTest("191.10.10.10", 8336, "191.10.10.10:8336")
// Private Class B // Private Class B
addNaTest("172.16.0.1", 8333, "172.16.0.1:8333") addNaTest("172.16.0.1", 16111, "172.16.0.1:16111")
addNaTest("172.16.1.1", 8334, "172.16.1.1:8334") addNaTest("172.16.1.1", 16110, "172.16.1.1:16110")
addNaTest("172.16.2.2", 8335, "172.16.2.2:8335") 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.172.172", 8336, "172.16.172.172:8336")
// Class C // Class C
addNaTest("193.0.0.1", 8333, "193.0.0.1:8333") addNaTest("193.0.0.1", 16111, "193.0.0.1:16111")
addNaTest("200.1.1.1", 8334, "200.1.1.1:8334") addNaTest("200.1.1.1", 16110, "200.1.1.1:16110")
addNaTest("205.2.2.2", 8335, "205.2.2.2:8335") addNaTest("205.2.2.2", 8335, "205.2.2.2:8335")
addNaTest("223.10.10.10", 8336, "223.10.10.10:8336") addNaTest("223.10.10.10", 8336, "223.10.10.10:8336")
// Private Class C // Private Class C
addNaTest("192.168.0.1", 8333, "192.168.0.1:8333") addNaTest("192.168.0.1", 16111, "192.168.0.1:16111")
addNaTest("192.168.1.1", 8334, "192.168.1.1:8334") addNaTest("192.168.1.1", 16110, "192.168.1.1:16110")
addNaTest("192.168.2.2", 8335, "192.168.2.2:8335") 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.192.192", 8336, "192.168.192.192:8336")
// IPv6 // IPv6
// Localhost // Localhost
addNaTest("::1", 8333, "[::1]:8333") addNaTest("::1", 16111, "[::1]:16111")
addNaTest("fe80::1", 8334, "[fe80::1]:8334") addNaTest("fe80::1", 16110, "[fe80::1]:16110")
// Link-local // Link-local
addNaTest("fe80::1:1", 8333, "[fe80::1:1]:8333") addNaTest("fe80::1:1", 16111, "[fe80::1:1]:16111")
addNaTest("fe91::2:2", 8334, "[fe91::2:2]:8334") addNaTest("fe91::2:2", 16110, "[fe91::2:2]:16110")
addNaTest("fea2::3:3", 8335, "[fea2::3:3]:8335") addNaTest("fea2::3:3", 8335, "[fea2::3:3]:8335")
addNaTest("feb3::4:4", 8336, "[feb3::4:4]:8336") addNaTest("feb3::4:4", 8336, "[feb3::4:4]:8336")
// Site-local // Site-local
addNaTest("fec0::1:1", 8333, "[fec0::1:1]:8333") addNaTest("fec0::1:1", 16111, "[fec0::1:1]:16111")
addNaTest("fed1::2:2", 8334, "[fed1::2:2]:8334") addNaTest("fed1::2:2", 16110, "[fed1::2:2]:16110")
addNaTest("fee2::3:3", 8335, "[fee2::3:3]:8335") addNaTest("fee2::3:3", 8335, "[fee2::3:3]:8335")
addNaTest("fef3::4:4", 8336, "[fef3::4:4]:8336") addNaTest("fef3::4:4", 8336, "[fef3::4:4]:8336")
} }
@ -133,7 +133,7 @@ func TestAddAddressByIP(t *testing.T) {
err error err error
}{ }{
{ {
someIP + ":8333", someIP + ":16111",
nil, nil,
}, },
{ {

View File

@ -52,7 +52,7 @@ func TestIPTypes(t *testing.T) {
rfc4193, rfc4380, rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598, rfc4193, rfc4380, rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598,
local, valid, routable bool) ipTest { local, valid, routable bool) ipTest {
nip := net.ParseIP(ip) nip := net.ParseIP(ip)
na := *wire.NewNetAddressIPPort(nip, 8333, wire.SFNodeNetwork) na := *wire.NewNetAddressIPPort(nip, 16111, wire.SFNodeNetwork)
test := ipTest{na, rfc1918, rfc2544, rfc3849, rfc3927, rfc3964, rfc4193, rfc4380, test := ipTest{na, rfc1918, rfc2544, rfc3849, rfc3927, rfc3964, rfc4193, rfc4380,
rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598, local, valid, routable} rfc4843, rfc4862, rfc5737, rfc6052, rfc6145, rfc6598, local, valid, routable}
return test return test

View File

@ -209,7 +209,7 @@ func TestHaveBlock(t *testing.T) {
{hash: dagconfig.SimNetParams.GenesisHash.String(), want: true}, {hash: dagconfig.SimNetParams.GenesisHash.String(), want: true},
// Block 3b should be present (as a second child of Block 2). // Block 3b should be present (as a second child of Block 2).
{hash: "6ffe9704c50b3f1892ce9e667337304ec0e9eb50a23673bc8ff7aaa20745ee4a", want: true}, {hash: "09e5e38f3fa2c5104b72b2f7122b2245085331e0d8cd1df79a3b12d66666ecb3", want: true},
// Block 100000 should be present (as an orphan). // Block 100000 should be present (as an orphan).
{hash: "65b20b048a074793ebfd1196e49341c8d194dabfc6b44a4fd0c607406e122baf", want: true}, {hash: "65b20b048a074793ebfd1196e49341c8d194dabfc6b44a4fd0c607406e122baf", want: true},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -116,13 +116,13 @@ func normalizeAddress(addr string, useTestNet, useSimNet, useDevNet bool) string
var defaultPort string var defaultPort string
switch { switch {
case useDevNet: case useDevNet:
fallthrough defaultPort = "16610"
case useTestNet: case useTestNet:
defaultPort = "18334" defaultPort = "16210"
case useSimNet: case useSimNet:
defaultPort = "18556" defaultPort = "16510"
default: default:
defaultPort = "8334" defaultPort = "16110"
} }
return net.JoinHostPort(addr, defaultPort) return net.JoinHostPort(addr, defaultPort)

View File

@ -99,7 +99,7 @@ type Flags struct {
AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"` AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"`
ConnectPeers []string `long:"connect" description:"Connect only to the specified peers at startup"` ConnectPeers []string `long:"connect" description:"Connect only to the specified peers at startup"`
DisableListen bool `long:"nolisten" description:"Disable listening for incoming connections -- NOTE: Listening is automatically disabled if the --connect or --proxy options are used without also specifying listen interfaces via --listen"` DisableListen bool `long:"nolisten" description:"Disable listening for incoming connections -- NOTE: Listening is automatically disabled if the --connect or --proxy options are used without also specifying listen interfaces via --listen"`
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: 16111, testnet: 16211)"`
TargetOutboundPeers int `long:"outpeers" description:"Target number of outbound peers"` TargetOutboundPeers int `long:"outpeers" description:"Target number of outbound peers"`
MaxInboundPeers int `long:"maxinpeers" description:"Max number of inbound peers"` MaxInboundPeers int `long:"maxinpeers" description:"Max number of inbound peers"`
DisableBanning bool `long:"nobanning" description:"Disable banning of misbehaving peers"` DisableBanning bool `long:"nobanning" description:"Disable banning of misbehaving peers"`
@ -110,7 +110,7 @@ type Flags struct {
RPCPass string `short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"` RPCPass string `short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
RPCLimitUser string `long:"rpclimituser" description:"Username for limited RPC connections"` RPCLimitUser string `long:"rpclimituser" description:"Username for limited RPC connections"`
RPCLimitPass string `long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"` RPCLimitPass string `long:"rpclimitpass" default-mask:"-" description:"Password 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: 16110, testnet: 16210)"`
RPCCert string `long:"rpccert" description:"File containing the certificate file"` RPCCert string `long:"rpccert" description:"File containing the certificate file"`
RPCKey string `long:"rpckey" description:"File containing the certificate key"` RPCKey string `long:"rpckey" description:"File containing the certificate key"`
RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"` RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"`

View File

@ -620,7 +620,7 @@ func TestListeners(t *testing.T) {
// Setup a connection manager with a couple of mock listeners that // Setup a connection manager with a couple of mock listeners that
// notify a channel when they receive mock connections. // notify a channel when they receive mock connections.
receivedConns := make(chan net.Conn) receivedConns := make(chan net.Conn)
listener1 := newMockListener("127.0.0.1:8333") listener1 := newMockListener("127.0.0.1:16111")
listener2 := newMockListener("127.0.0.1:9333") listener2 := newMockListener("127.0.0.1:9333")
listeners := []net.Listener{listener1, listener2} listeners := []net.Listener{listener1, listener2}
cmgr, err := New(&Config{ cmgr, err := New(&Config{

View File

@ -182,8 +182,8 @@ var MainNetParams = Params{
K: phantomK, K: phantomK,
Name: "mainnet", Name: "mainnet",
Net: wire.MainNet, Net: wire.MainNet,
RPCPort: "8334", RPCPort: "16110",
DefaultPort: "8333", DefaultPort: "16111",
DNSSeeds: []string{}, DNSSeeds: []string{},
// DAG parameters // DAG parameters
@ -240,8 +240,8 @@ var RegressionNetParams = Params{
K: phantomK, K: phantomK,
Name: "regtest", Name: "regtest",
Net: wire.RegTest, Net: wire.RegTest,
RPCPort: "18334", RPCPort: "16210",
DefaultPort: "18444", DefaultPort: "16211",
DNSSeeds: []string{}, DNSSeeds: []string{},
// DAG parameters // DAG parameters
@ -296,8 +296,8 @@ var TestNetParams = Params{
K: phantomK, K: phantomK,
Name: "testnet", Name: "testnet",
Net: wire.TestNet, Net: wire.TestNet,
RPCPort: "18334", RPCPort: "16210",
DefaultPort: "18333", DefaultPort: "16211",
DNSSeeds: []string{}, DNSSeeds: []string{},
// DAG parameters // DAG parameters
@ -358,8 +358,8 @@ var SimNetParams = Params{
K: phantomK, K: phantomK,
Name: "simnet", Name: "simnet",
Net: wire.SimNet, Net: wire.SimNet,
RPCPort: "18556", RPCPort: "16510",
DefaultPort: "18555", DefaultPort: "16511",
DNSSeeds: []string{}, // NOTE: There must NOT be any seeds. DNSSeeds: []string{}, // NOTE: There must NOT be any seeds.
// DAG parameters // DAG parameters
@ -412,8 +412,8 @@ var DevNetParams = Params{
K: phantomK, K: phantomK,
Name: "devnet", Name: "devnet",
Net: wire.DevNet, Net: wire.DevNet,
RPCPort: "18334", RPCPort: "16610",
DefaultPort: "18333", DefaultPort: "16611",
DNSSeeds: []string{}, DNSSeeds: []string{},
// DAG parameters // DAG parameters

Binary file not shown.

View File

@ -13,6 +13,7 @@ import (
"github.com/kaspanet/kaspad/dagconfig" "github.com/kaspanet/kaspad/dagconfig"
"github.com/kaspanet/kaspad/util/daghash" "github.com/kaspanet/kaspad/util/daghash"
"github.com/kaspanet/kaspad/wire" "github.com/kaspanet/kaspad/wire"
"github.com/pkg/errors"
) )
func main() { func main() {

4
doc.go
View File

@ -32,7 +32,7 @@ Application Options:
or --proxy options are used without also specifying or --proxy options are used without also specifying
listen interfaces via --listen listen interfaces via --listen
--listen= Add an interface/port to listen for connections --listen= Add an interface/port to listen for connections
(default all interfaces port: 8333, testnet: 18333) (default all interfaces port: 16111, testnet: 16211)
--maxpeers= Max number of inbound and outbound peers (125) --maxpeers= Max number of inbound and outbound peers (125)
--nobanning Disable banning of misbehaving peers --nobanning Disable banning of misbehaving peers
--banduration= How long to ban misbehaving peers. Valid time units --banduration= How long to ban misbehaving peers. Valid time units
@ -46,7 +46,7 @@ Application Options:
--rpclimituser= Username for limited RPC connections --rpclimituser= Username for limited RPC connections
--rpclimitpass= Password for limited RPC connections --rpclimitpass= Password for limited RPC connections
--rpclisten= Add an interface/port to listen for RPC connections --rpclisten= Add an interface/port to listen for RPC connections
(default port: 8334, testnet: 18334) (default port: 16110, testnet: 16210)
--rpccert= File containing the certificate file --rpccert= File containing the certificate file
--rpckey= File containing the certificate key --rpckey= File containing the certificate key
--rpcmaxclients= Max number of RPC clients for standard connections --rpcmaxclients= Max number of RPC clients for standard connections

View File

@ -195,7 +195,7 @@ certificate into the default system Certificate Authority list.
**3. Set your mining software url to use https.** **3. Set your mining software url to use https.**
`$ cgminer -o https://127.0.0.1:8334 -u rpcuser -p rpcpassword` `$ cgminer -o https://127.0.0.1:16110 -u rpcuser -p rpcpassword`
<a name="Help" /> <a name="Help" />

View File

@ -14,22 +14,22 @@ Command Line Examples:
|--listen=|all interfaces on default port which is changed by `--testnet` and `--regtest` (**default**)| |--listen=|all interfaces on default port which is changed by `--testnet` and `--regtest` (**default**)|
|--listen=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet` and `--regtest`| |--listen=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet` and `--regtest`|
|--listen=::|all IPv6 interfaces on default port which is changed by `--testnet` and `--regtest`| |--listen=::|all IPv6 interfaces on default port which is changed by `--testnet` and `--regtest`|
|--listen=:8333|all interfaces on port 8333| |--listen=:16111|all interfaces on port 16111|
|--listen=0.0.0.0:8333|all IPv4 interfaces on port 8333| |--listen=0.0.0.0:16111|all IPv4 interfaces on port 16111|
|--listen=[::]:8333|all IPv6 interfaces on port 8333| |--listen=[::]:16111|all IPv6 interfaces on port 16111|
|--listen=127.0.0.1:8333|only IPv4 localhost on port 8333| |--listen=127.0.0.1:16111|only IPv4 localhost on port 16111|
|--listen=[::1]:8333|only IPv6 localhost on port 8333| |--listen=[::1]:16111|only IPv6 localhost on port 16111|
|--listen=:8336|all interfaces on non-standard port 8336| |--listen=:8336|all interfaces on non-standard port 8336|
|--listen=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336| |--listen=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
|--listen=[::]:8336|all IPv6 interfaces on non-standard port 8336| |--listen=[::]:8336|all IPv6 interfaces on non-standard port 8336|
|--listen=127.0.0.1:8337 --listen=[::1]:8333|IPv4 localhost on port 8337 and IPv6 localhost on port 8333| |--listen=127.0.0.1:8337 --listen=[::1]:16111|IPv4 localhost on port 8337 and IPv6 localhost on port 16111|
|--listen=:8333 --listen=:8337|all interfaces on ports 8333 and 8337| |--listen=:16111 --listen=:8337|all interfaces on ports 16111 and 8337|
The following config file would configure btcd to only listen on localhost for both IPv4 and IPv6: The following config file would configure btcd to only listen on localhost for both IPv4 and IPv6:
```text ```text
[Application Options] [Application Options]
listen=127.0.0.1:8333 listen=127.0.0.1:16111
listen=[::1]:8333 listen=[::1]:16111
``` ```

View File

@ -27,16 +27,16 @@ Command Line Examples:
|--rpclisten=|all interfaces on default port which is changed by `--testnet`| |--rpclisten=|all interfaces on default port which is changed by `--testnet`|
|--rpclisten=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet`| |--rpclisten=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet`|
|--rpclisten=::|all IPv6 interfaces on default port which is changed by `--testnet`| |--rpclisten=::|all IPv6 interfaces on default port which is changed by `--testnet`|
|--rpclisten=:8334|all interfaces on port 8334| |--rpclisten=:16110|all interfaces on port 16110|
|--rpclisten=0.0.0.0:8334|all IPv4 interfaces on port 8334| |--rpclisten=0.0.0.0:16110|all IPv4 interfaces on port 16110|
|--rpclisten=[::]:8334|all IPv6 interfaces on port 8334| |--rpclisten=[::]:16110|all IPv6 interfaces on port 16110|
|--rpclisten=127.0.0.1:8334|only IPv4 localhost on port 8334| |--rpclisten=127.0.0.1:16110|only IPv4 localhost on port 16110|
|--rpclisten=[::1]:8334|only IPv6 localhost on port 8334| |--rpclisten=[::1]:16110|only IPv6 localhost on port 16110|
|--rpclisten=:8336|all interfaces on non-standard port 8336| |--rpclisten=:8336|all interfaces on non-standard port 8336|
|--rpclisten=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336| |--rpclisten=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
|--rpclisten=[::]:8336|all IPv6 interfaces on non-standard port 8336| |--rpclisten=[::]:8336|all IPv6 interfaces on non-standard port 8336|
|--rpclisten=127.0.0.1:8337 --listen=[::1]:8334|IPv4 localhost on port 8337 and IPv6 localhost on port 8334| |--rpclisten=127.0.0.1:8337 --listen=[::1]:16110|IPv4 localhost on port 8337 and IPv6 localhost on port 16110|
|--rpclisten=:8334 --listen=:8337|all interfaces on ports 8334 and 8337| |--rpclisten=:16110 --listen=:8337|all interfaces on ports 16110 and 8337|
The following config file would configure the btcd RPC server to listen to all interfaces on the default port, including external interfaces, for both IPv4 and IPv6: The following config file would configure the btcd RPC server to listen to all interfaces on the default port, including external interfaces, for both IPv4 and IPv6:

View File

@ -97,7 +97,7 @@ address.
```text ```text
HiddenServiceDir /var/tor/btcd HiddenServiceDir /var/tor/btcd
HiddenServicePort 8333 127.0.0.1:8333 HiddenServicePort 16111 127.0.0.1:16111
``` ```
Once Tor is configured to provide the hidden service and you have obtained your Once Tor is configured to provide the hidden service and you have obtained your

View File

@ -11,5 +11,5 @@ configurations.
|Name|Port| |Name|Port|
|----|----| |----|----|
|Default Bitcoin peer-to-peer port|TCP 8333| |Default Bitcoin peer-to-peer port|TCP 16111|
|Default RPC port|TCP 8334| |Default RPC port|TCP 16110|

View File

@ -46,7 +46,7 @@ differences between btcd and bitcoind as far as how RPCs are serviced:
Websockets are the preferred transport for btcd RPC and are used by applications Websockets are the preferred transport for btcd RPC and are used by applications
such as [btcwallet](https://github.com/btcsuite/btcwallet) for inter-process such as [btcwallet](https://github.com/btcsuite/btcwallet) for inter-process
communication with btcd. The websocket connection endpoint for btcd is communication with btcd. The websocket connection endpoint for btcd is
`wss://your_ip_or_domain:8334/ws`. `wss://your_ip_or_domain:16110/ws`.
In addition to the [standard API](#Methods), an [extension API](#WSExtMethods) In addition to the [standard API](#Methods), an [extension API](#WSExtMethods)
has been developed that is exclusive to clients using Websockets. In its current has been developed that is exclusive to clients using Websockets. In its current
@ -71,7 +71,7 @@ indicates, the [Websocket-specific extension](#WSExtMethods) methods can only be
accessed when connected via Websockets. accessed when connected via Websockets.
As mentioned in the [overview](#Overview), the websocket connection endpoint for As mentioned in the [overview](#Overview), the websocket connection endpoint for
btcd is `wss://your_ip_or_domain:8334/ws`. btcd is `wss://your_ip_or_domain:16110/ws`.
The most important differences between the two transports as it pertains to the The most important differences between the two transports as it pertains to the
JSON-RPC API are: JSON-RPC API are:
@ -1102,7 +1102,7 @@ func main() {
// not long-lived, the connection will be closed as soon as the program // not long-lived, the connection will be closed as soon as the program
// exits. // exits.
connCfg := &btcrpcclient.ConnConfig{ connCfg := &btcrpcclient.ConnConfig{
Host: "localhost:8334", Host: "localhost:16110",
Endpoint: "ws", Endpoint: "ws",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",
@ -1166,7 +1166,7 @@ func main() {
// not long-lived, the connection will be closed as soon as the program // not long-lived, the connection will be closed as soon as the program
// exits. // exits.
connCfg := &btcrpcclient.ConnConfig{ connCfg := &btcrpcclient.ConnConfig{
Host: "localhost:18334", Host: "localhost:16210",
Endpoint: "ws", Endpoint: "ws",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",
@ -1267,7 +1267,7 @@ func main() {
// Create a new RPC client using websockets. // Create a new RPC client using websockets.
connCfg := &btcrpcclient.ConnConfig{ connCfg := &btcrpcclient.ConnConfig{
Host: "localhost:8334", Host: "localhost:16110",
Endpoint: "ws", Endpoint: "ws",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",
@ -1338,7 +1338,7 @@ var password = "yourpassword";
// Initiate the websocket connection. The btcd generated certificate acts as // Initiate the websocket connection. The btcd generated certificate acts as
// its own certificate authority, so it needs to be specified in the 'ca' array // its own certificate authority, so it needs to be specified in the 'ca' array
// for the certificate to properly validate. // for the certificate to properly validate.
var ws = new WebSocket('wss://127.0.0.1:8334/ws', { var ws = new WebSocket('wss://127.0.0.1:16110/ws', {
headers: { headers: {
'Authorization': 'Basic '+new Buffer(user+':'+password).toString('base64') 'Authorization': 'Basic '+new Buffer(user+':'+password).toString('base64')
}, },

View File

@ -49,7 +49,7 @@ func newConfig(prefix, certFile, keyFile string, extra []string) (*nodeConfig, e
a := &nodeConfig{ a := &nodeConfig{
listen: "127.0.0.1:18555", listen: "127.0.0.1:18555",
rpcListen: "127.0.0.1:18556", rpcListen: "127.0.0.1:16510",
rpcUser: "user", rpcUser: "user",
rpcPass: "pass", rpcPass: "pass",
extra: extra, extra: extra,

View File

@ -267,13 +267,13 @@ func TestPeerConnection(t *testing.T) {
"basic handshake", "basic handshake",
func() (*peer.Peer, *peer.Peer, error) { func() (*peer.Peer, *peer.Peer, error) {
inConn, outConn := pipe( inConn, outConn := pipe(
&conn{raddr: "10.0.0.1:8333"}, &conn{raddr: "10.0.0.1:16111"},
&conn{raddr: "10.0.0.2:8333"}, &conn{raddr: "10.0.0.2:16111"},
) )
inPeer := peer.NewInboundPeer(peer1Cfg) inPeer := peer.NewInboundPeer(peer1Cfg)
inPeer.AssociateConnection(inConn) inPeer.AssociateConnection(inConn)
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:8333") outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:16111")
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
@ -293,13 +293,13 @@ func TestPeerConnection(t *testing.T) {
"socks proxy", "socks proxy",
func() (*peer.Peer, *peer.Peer, error) { func() (*peer.Peer, *peer.Peer, error) {
inConn, outConn := pipe( inConn, outConn := pipe(
&conn{raddr: "10.0.0.1:8333", proxy: true}, &conn{raddr: "10.0.0.1:16111", proxy: true},
&conn{raddr: "10.0.0.2:8333"}, &conn{raddr: "10.0.0.2:16111"},
) )
inPeer := peer.NewInboundPeer(peer1Cfg) inPeer := peer.NewInboundPeer(peer1Cfg)
inPeer.AssociateConnection(inConn) inPeer.AssociateConnection(inConn)
outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:8333") outPeer, err := peer.NewOutboundPeer(peer2Cfg, "10.0.0.2:16111")
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
@ -405,8 +405,8 @@ func TestPeerListeners(t *testing.T) {
SelectedTip: fakeSelectedTipFn, SelectedTip: fakeSelectedTipFn,
} }
inConn, outConn := pipe( inConn, outConn := pipe(
&conn{raddr: "10.0.0.1:8333"}, &conn{raddr: "10.0.0.1:16111"},
&conn{raddr: "10.0.0.2:8333"}, &conn{raddr: "10.0.0.2:16111"},
) )
inPeer := peer.NewInboundPeer(peerCfg) inPeer := peer.NewInboundPeer(peerCfg)
inPeer.AssociateConnection(inConn) inPeer.AssociateConnection(inConn)
@ -416,7 +416,7 @@ func TestPeerListeners(t *testing.T) {
verack <- struct{}{} verack <- struct{}{}
}, },
} }
outPeer, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333") outPeer, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
if err != nil { if err != nil {
t.Errorf("NewOutboundPeer: unexpected err %v\n", err) t.Errorf("NewOutboundPeer: unexpected err %v\n", err)
return return
@ -538,9 +538,9 @@ func TestOutboundPeer(t *testing.T) {
} }
r, w := io.Pipe() r, w := io.Pipe()
c := &conn{raddr: "10.0.0.1:8333", Writer: w, Reader: r} c := &conn{raddr: "10.0.0.1:16111", Writer: w, Reader: r}
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333") p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
if err != nil { if err != nil {
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err) t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
return return
@ -579,8 +579,8 @@ func TestOutboundPeer(t *testing.T) {
peerCfg.SelectedTip = selectedTip peerCfg.SelectedTip = selectedTip
r1, w1 := io.Pipe() r1, w1 := io.Pipe()
c1 := &conn{raddr: "10.0.0.1:8333", Writer: w1, Reader: r1} c1 := &conn{raddr: "10.0.0.1:16111", Writer: w1, Reader: r1}
p1, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333") p1, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
if err != nil { if err != nil {
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err) t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
return return
@ -595,8 +595,8 @@ func TestOutboundPeer(t *testing.T) {
peerCfg.DAGParams = &dagconfig.RegressionNetParams peerCfg.DAGParams = &dagconfig.RegressionNetParams
peerCfg.Services = wire.SFNodeBloom peerCfg.Services = wire.SFNodeBloom
r2, w2 := io.Pipe() r2, w2 := io.Pipe()
c2 := &conn{raddr: "10.0.0.1:8333", Writer: w2, Reader: r2} c2 := &conn{raddr: "10.0.0.1:16111", Writer: w2, Reader: r2}
p2, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333") p2, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
if err != nil { if err != nil {
t.Errorf("NewOutboundPeer: unexpected err - %v\n", err) t.Errorf("NewOutboundPeer: unexpected err - %v\n", err)
return return
@ -649,20 +649,20 @@ func TestUnsupportedVersionPeer(t *testing.T) {
localNA := wire.NewNetAddressIPPort( localNA := wire.NewNetAddressIPPort(
net.ParseIP("10.0.0.1"), net.ParseIP("10.0.0.1"),
uint16(8333), uint16(16111),
wire.SFNodeNetwork, wire.SFNodeNetwork,
) )
remoteNA := wire.NewNetAddressIPPort( remoteNA := wire.NewNetAddressIPPort(
net.ParseIP("10.0.0.2"), net.ParseIP("10.0.0.2"),
uint16(8333), uint16(16111),
wire.SFNodeNetwork, wire.SFNodeNetwork,
) )
localConn, remoteConn := pipe( localConn, remoteConn := pipe(
&conn{laddr: "10.0.0.1:8333", raddr: "10.0.0.2:8333"}, &conn{laddr: "10.0.0.1:16111", raddr: "10.0.0.2:16111"},
&conn{laddr: "10.0.0.2:8333", raddr: "10.0.0.1:8333"}, &conn{laddr: "10.0.0.2:16111", raddr: "10.0.0.1:16111"},
) )
p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:8333") p, err := peer.NewOutboundPeer(peerCfg, "10.0.0.1:16111")
if err != nil { if err != nil {
t.Fatalf("NewOutboundPeer: unexpected err - %v\n", err) t.Fatalf("NewOutboundPeer: unexpected err - %v\n", err)
} }

View File

@ -34,7 +34,7 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
connCfg := &rpcclient.ConnConfig{ connCfg := &rpcclient.ConnConfig{
Host: "localhost:8334", Host: "localhost:16110",
Endpoint: "ws", Endpoint: "ws",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",

View File

@ -86,9 +86,9 @@
; You may specify each IP address with or without a port. The default port will ; You may specify each IP address with or without a port. The default port will
; be added automatically if one is not specified here. ; be added automatically if one is not specified here.
; addpeer=192.168.1.1 ; addpeer=192.168.1.1
; addpeer=10.0.0.2:8333 ; addpeer=10.0.0.2:16111
; addpeer=fe80::1 ; addpeer=fe80::1
; addpeer=[fe80::2]:8333 ; addpeer=[fe80::2]:16111
; Add persistent peers that you ONLY want to connect to as desired. One peer ; Add persistent peers that you ONLY want to connect to as desired. One peer
; per line. You may specify each IP address with or without a port. The ; per line. You may specify each IP address with or without a port. The
@ -96,9 +96,9 @@
; NOTE: Specifying this option has other side effects as described above in ; NOTE: Specifying this option has other side effects as described above in
; the 'addpeer' versus 'connect' summary section. ; the 'addpeer' versus 'connect' summary section.
; connect=192.168.1.1 ; connect=192.168.1.1
; connect=10.0.0.2:8333 ; connect=10.0.0.2:16111
; connect=fe80::1 ; connect=fe80::1
; connect=[fe80::2]:8333 ; connect=[fe80::2]:16111
; Maximum number of inbound and outbound peers. ; Maximum number of inbound and outbound peers.
; maxpeers=125 ; maxpeers=125
@ -135,12 +135,12 @@
; listen=0.0.0.0 ; listen=0.0.0.0
; All ipv6 interfaces on default port: ; All ipv6 interfaces on default port:
; listen=:: ; listen=::
; All interfaces on port 8333: ; All interfaces on port 16111:
; listen=:8333 ; listen=:16111
; All ipv4 interfaces on port 8333: ; All ipv4 interfaces on port 16111:
; listen=0.0.0.0:8333 ; listen=0.0.0.0:16111
; All ipv6 interfaces on port 8333: ; All ipv6 interfaces on port 16111:
; listen=[::]:8333 ; listen=[::]:16111
; Only ipv4 localhost on port 8333: ; Only ipv4 localhost on port 8333:
; listen=127.0.0.1:8333 ; listen=127.0.0.1:8333
; Only ipv6 localhost on port 8333: ; Only ipv6 localhost on port 8333:
@ -195,16 +195,16 @@
; rpclisten=0.0.0.0 ; rpclisten=0.0.0.0
; All ipv6 interfaces on default port: ; All ipv6 interfaces on default port:
; rpclisten=:: ; rpclisten=::
; All interfaces on port 8334: ; All interfaces on port 16110:
; rpclisten=:8334 ; rpclisten=:16110
; All ipv4 interfaces on port 8334: ; All ipv4 interfaces on port 16110:
; rpclisten=0.0.0.0:8334 ; rpclisten=0.0.0.0:16110
; All ipv6 interfaces on port 8334: ; All ipv6 interfaces on port 16110:
; rpclisten=[::]:8334 ; rpclisten=[::]:16110
; Only ipv4 localhost on port 8334: ; Only ipv4 localhost on port 16110:
; rpclisten=127.0.0.1:8334 ; rpclisten=127.0.0.1:16110
; Only ipv6 localhost on port 8334: ; Only ipv6 localhost on port 16110:
; rpclisten=[::1]:8334 ; rpclisten=[::1]:16110
; Only ipv4 localhost on non-standard port 8337: ; Only ipv4 localhost on non-standard port 8337:
; rpclisten=127.0.0.1:8337 ; rpclisten=127.0.0.1:8337
; All interfaces on non-standard port 8337: ; All interfaces on non-standard port 8337:

View File

@ -132,7 +132,7 @@ func TestElementWire(t *testing.T) {
}, },
{ {
KaspaNet(MainNet), KaspaNet(MainNet),
[]byte{0xf9, 0xbe, 0xb4, 0xd9}, []byte{0x1d, 0xf7, 0xdc, 0x3d},
}, },
// Type not supported by the "fast" path and requires reflection. // Type not supported by the "fast" path and requires reflection.
{ {

View File

@ -40,10 +40,10 @@ func TestMessage(t *testing.T) {
// Create the various types of messages to test. // Create the various types of messages to test.
// MsgVersion. // MsgVersion.
addrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 8333} addrYou := &net.TCPAddr{IP: net.ParseIP("192.168.0.1"), Port: 16111}
you := NewNetAddress(addrYou, SFNodeNetwork) you := NewNetAddress(addrYou, SFNodeNetwork)
you.Timestamp = time.Time{} // Version message has zero value timestamp. 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: 16111}
me := NewNetAddress(addrMe, SFNodeNetwork) me := NewNetAddress(addrMe, SFNodeNetwork)
me.Timestamp = time.Time{} // Version message has zero value timestamp. me.Timestamp = time.Time{} // Version message has zero value timestamp.
msgVersion := NewMsgVersion(me, you, 123123, &daghash.ZeroHash, nil) msgVersion := NewMsgVersion(me, you, 123123, &daghash.ZeroHash, nil)

View File

@ -39,7 +39,7 @@ func TestAddr(t *testing.T) {
} }
// Ensure NetAddresses are added properly. // 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: 16111}
na := NewNetAddress(tcpAddr, SFNodeNetwork) na := NewNetAddress(tcpAddr, SFNodeNetwork)
err := msg.AddAddress(na) err := msg.AddAddress(na)
if err != nil { if err != nil {
@ -82,13 +82,13 @@ func TestAddrWire(t *testing.T) {
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("127.0.0.1"), IP: net.ParseIP("127.0.0.1"),
Port: 8333, Port: 16111,
} }
na2 := &NetAddress{ na2 := &NetAddress{
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("192.168.0.1"), IP: net.ParseIP("192.168.0.1"),
Port: 8334, Port: 16110,
} }
// Empty address message. // Empty address message.
@ -109,12 +109,12 @@ func TestAddrWire(t *testing.T) {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1 0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
0x20, 0x8e, // Port 8334 in big-endian 0x3e, 0xee, // Port 16110 in big-endian
} }
// Address message with multiple addresses and subnetworkID. // Address message with multiple addresses and subnetworkID.
@ -131,12 +131,12 @@ func TestAddrWire(t *testing.T) {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1 0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
0x20, 0x8e, // Port 8334 in big-endian 0x3e, 0xee, // Port 16110 in big-endian
} }
tests := []struct { tests := []struct {
@ -212,13 +212,13 @@ func TestAddrWireErrors(t *testing.T) {
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("127.0.0.1"), IP: net.ParseIP("127.0.0.1"),
Port: 8333, Port: 16111,
} }
na2 := &NetAddress{ na2 := &NetAddress{
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("192.168.0.1"), IP: net.ParseIP("192.168.0.1"),
Port: 8334, Port: 16110,
} }
// Address message with multiple addresses. // Address message with multiple addresses.
@ -231,12 +231,12 @@ func TestAddrWireErrors(t *testing.T) {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp 0x29, 0xab, 0x5f, 0x49, 0x00, 0x00, 0x00, 0x00, // Timestamp
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1 0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
0x20, 0x8e, // Port 8334 in big-endian 0x3e, 0xee, // Port 16110 in big-endian
} }
// Message that forces an error by having more than the max allowed // Message that forces an error by having more than the max allowed

View File

@ -24,9 +24,9 @@ func TestVersion(t *testing.T) {
// Create version message data. // Create version message data.
selectedTip := &daghash.Hash{12, 34} selectedTip := &daghash.Hash{12, 34}
tcpAddrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333} tcpAddrMe := &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 16111}
me := NewNetAddress(tcpAddrMe, SFNodeNetwork) 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: 16111}
you := NewNetAddress(tcpAddrYou, SFNodeNetwork) you := NewNetAddress(tcpAddrYou, SFNodeNetwork)
nonce, err := random.Uint64() nonce, err := random.Uint64()
if err != nil { if err != nil {
@ -313,13 +313,13 @@ var baseVersion = &MsgVersion{
Timestamp: time.Time{}, // Zero value -- no timestamp in version Timestamp: time.Time{}, // Zero value -- no timestamp in version
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("192.168.0.1"), IP: net.ParseIP("192.168.0.1"),
Port: 8333, Port: 16111,
}, },
AddrMe: NetAddress{ AddrMe: NetAddress{
Timestamp: time.Time{}, // Zero value -- no timestamp in version Timestamp: time.Time{}, // Zero value -- no timestamp in version
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("127.0.0.1"), IP: net.ParseIP("127.0.0.1"),
Port: 8333, Port: 16111,
}, },
Nonce: 123123, // 0x1e0f3 Nonce: 123123, // 0x1e0f3
UserAgent: "/kaspadtest:0.0.1/", UserAgent: "/kaspadtest:0.0.1/",
@ -337,12 +337,12 @@ var baseVersionEncoded = []byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1 0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
// AddrMe -- No timestamp for NetAddress in version message // AddrMe -- No timestamp for NetAddress in version message
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Fake Nonce. TODO: (Ori) Replace to a real nonce
0x12, // Varint for user agent length 0x12, // Varint for user agent length
0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74,
@ -363,13 +363,13 @@ var baseVersionWithRelayTx = &MsgVersion{
Timestamp: time.Time{}, // Zero value -- no timestamp in version Timestamp: time.Time{}, // Zero value -- no timestamp in version
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("192.168.0.1"), IP: net.ParseIP("192.168.0.1"),
Port: 8333, Port: 16111,
}, },
AddrMe: NetAddress{ AddrMe: NetAddress{
Timestamp: time.Time{}, // Zero value -- no timestamp in version Timestamp: time.Time{}, // Zero value -- no timestamp in version
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("127.0.0.1"), IP: net.ParseIP("127.0.0.1"),
Port: 8333, Port: 16111,
}, },
Nonce: 123123, // 0x1e0f3 Nonce: 123123, // 0x1e0f3
UserAgent: "/kaspadtest:0.0.1/", UserAgent: "/kaspadtest:0.0.1/",
@ -387,12 +387,12 @@ var baseVersionWithRelayTxEncoded = []byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1 0x00, 0x00, 0xff, 0xff, 0xc0, 0xa8, 0x00, 0x01, // IP 192.168.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
// AddrMe -- No timestamp for NetAddress in version message // AddrMe -- No timestamp for NetAddress in version message
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // Nonce
0x12, // Varint for user agent length 0x12, // Varint for user agent length
0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74, 0x2f, 0x6b, 0x61, 0x73, 0x70, 0x61, 0x64, 0x74,

View File

@ -18,7 +18,7 @@ import (
// TestNetAddress tests the NetAddress API. // TestNetAddress tests the NetAddress API.
func TestNetAddress(t *testing.T) { func TestNetAddress(t *testing.T) {
ip := net.ParseIP("127.0.0.1") ip := net.ParseIP("127.0.0.1")
port := 8333 port := 16111
// Test NewNetAddress. // Test NewNetAddress.
na := NewNetAddress(&net.TCPAddr{IP: ip, Port: port}, 0) na := NewNetAddress(&net.TCPAddr{IP: ip, Port: port}, 0)
@ -68,7 +68,7 @@ func TestNetAddressWire(t *testing.T) {
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("127.0.0.1"), IP: net.ParseIP("127.0.0.1"),
Port: 8333, Port: 16111,
} }
// baseNetAddrNoTS is baseNetAddr with a zero value for the timestamp. // baseNetAddrNoTS is baseNetAddr with a zero value for the timestamp.
@ -81,7 +81,7 @@ func TestNetAddressWire(t *testing.T) {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
} }
// baseNetAddrNoTSEncoded is the wire encoded bytes of baseNetAddrNoTS. // baseNetAddrNoTSEncoded is the wire encoded bytes of baseNetAddrNoTS.
@ -90,7 +90,7 @@ func TestNetAddressWire(t *testing.T) {
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // SFNodeNetwork
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x01, // IP 127.0.0.1
0x20, 0x8d, // Port 8333 in big-endian 0x3e, 0xef, // Port 16111 in big-endian
} }
tests := []struct { tests := []struct {
@ -160,7 +160,7 @@ func TestNetAddressWireErrors(t *testing.T) {
Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST Timestamp: time.Unix(0x495fab29, 0), // 2009-01-03 12:15:05 -0600 CST
Services: SFNodeNetwork, Services: SFNodeNetwork,
IP: net.ParseIP("127.0.0.1"), IP: net.ParseIP("127.0.0.1"),
Port: 8333, Port: 16111,
} }
tests := []struct { tests := []struct {

View File

@ -98,19 +98,19 @@ type KaspaNet uint32
// better idea to simply disconnect clients that are misbehaving over TCP. // better idea to simply disconnect clients that are misbehaving over TCP.
const ( const (
// MainNet represents the main kaspa network. // MainNet represents the main kaspa network.
MainNet KaspaNet = 0xd9b4bef9 MainNet KaspaNet = 0x3ddcf71d
// TestNet represents the test network. // TestNet represents the test network.
TestNet KaspaNet = 0x0709110b TestNet KaspaNet = 0xddb8af8f
// RegTest represents the regression test network. // RegTest represents the regression test network.
RegTest KaspaNet = 0xdab5bffa RegTest KaspaNet = 0xf396cdd6
// SimNet represents the simulation test network. // SimNet represents the simulation test network.
SimNet KaspaNet = 0x12141c16 SimNet KaspaNet = 0x374dcf1c
// DevNet represents the development test network. // DevNet represents the development test network.
DevNet KaspaNet = 0x01020304 DevNet KaspaNet = 0x732d87e1
) )
// bnStrings is a map of kaspa networks back to their constant names for // bnStrings is a map of kaspa networks back to their constant names for