Added testnet defaults

This commit is contained in:
StephenButtolph 2020-03-31 18:32:10 -04:00
parent c43d77da30
commit 7a369e66b0
3 changed files with 33 additions and 22 deletions

View File

@ -42,15 +42,15 @@ import (
// Hardcoded network IDs // Hardcoded network IDs
const ( const (
MainnetID uint32 = 1 MainnetID uint32 = 1
TestnetID uint32 = 2 TestnetID uint32 = 2
BorealisID uint32 = 2 CascadeID uint32 = 2
LocalID uint32 = 12345 LocalID uint32 = 12345
MainnetName = "mainnet" MainnetName = "mainnet"
TestnetName = "testnet" TestnetName = "testnet"
BorealisName = "borealis" CascadeName = "cascade"
LocalName = "local" LocalName = "local"
) )
var ( var (
@ -62,14 +62,14 @@ var (
// Give special names to the mainnet and testnet // Give special names to the mainnet and testnet
NetworkIDToNetworkName = map[uint32]string{ NetworkIDToNetworkName = map[uint32]string{
MainnetID: MainnetName, MainnetID: MainnetName,
TestnetID: BorealisName, TestnetID: CascadeName,
LocalID: LocalName, LocalID: LocalName,
} }
NetworkNameToNetworkID = map[string]uint32{ NetworkNameToNetworkID = map[string]uint32{
MainnetName: MainnetID, MainnetName: MainnetID,
TestnetName: TestnetID, TestnetName: TestnetID,
BorealisName: BorealisID, CascadeName: CascadeID,
LocalName: LocalID, LocalName: LocalID,
} }
MintAddresses = []string{ MintAddresses = []string{
"95YUFjhDG892VePMzpwKF9JzewGKvGRi3", "95YUFjhDG892VePMzpwKF9JzewGKvGRi3",

View File

@ -17,11 +17,11 @@ func TestNetworkName(t *testing.T) {
if name := NetworkName(MainnetID); name != MainnetName { if name := NetworkName(MainnetID); name != MainnetName {
t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, MainnetName) t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, MainnetName)
} }
if name := NetworkName(TestnetID); name != BorealisName { if name := NetworkName(TestnetID); name != CascadeName {
t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, BorealisName) t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, CascadeName)
} }
if name := NetworkName(BorealisID); name != BorealisName { if name := NetworkName(CascadeID); name != CascadeName {
t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, BorealisName) t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, CascadeName)
} }
if name := NetworkName(4294967295); name != "network-4294967295" { if name := NetworkName(4294967295); name != "network-4294967295" {
t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, "network-4294967295") t.Fatalf("NetworkID was incorrectly named. Result: %s ; Expected: %s", name, "network-4294967295")
@ -45,7 +45,7 @@ func TestNetworkID(t *testing.T) {
t.Fatalf("Returned wrong network. Expected: %d ; Returned %d", TestnetID, id) t.Fatalf("Returned wrong network. Expected: %d ; Returned %d", TestnetID, id)
} }
id, err = NetworkID(BorealisName) id, err = NetworkID(CascadeName)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -53,7 +53,7 @@ func TestNetworkID(t *testing.T) {
t.Fatalf("Returned wrong network. Expected: %d ; Returned %d", TestnetID, id) t.Fatalf("Returned wrong network. Expected: %d ; Returned %d", TestnetID, id)
} }
id, err = NetworkID("bOrEaLiS") id, err = NetworkID("cAsCaDe")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -33,6 +33,17 @@ var (
Err error Err error
) )
// Bootstrap configs
var (
BootstrapIPs = []string{
"3.227.207.132:21001",
"34.207.133.167:21001",
"107.23.241.199:21001",
"54.197.215.186:21001",
"18.234.153.22:21001",
}
)
var ( var (
errBootstrapMismatch = errors.New("more bootstrap IDs provided than bootstrap IPs") errBootstrapMismatch = errors.New("more bootstrap IDs provided than bootstrap IPs")
) )
@ -48,7 +59,7 @@ func init() {
fs := flag.NewFlagSet("gecko", flag.ContinueOnError) fs := flag.NewFlagSet("gecko", flag.ContinueOnError)
// NetworkID: // NetworkID:
networkName := fs.String("network-id", genesis.LocalName, "Network ID this node will connect to") networkName := fs.String("network-id", genesis.CascadeName, "Network ID this node will connect to")
// Ava fees: // Ava fees:
fs.Uint64Var(&Config.AvaTxFee, "ava-tx-fee", 0, "Ava transaction fee, in $nAva") fs.Uint64Var(&Config.AvaTxFee, "ava-tx-fee", 0, "Ava transaction fee, in $nAva")
@ -73,8 +84,8 @@ func init() {
fs.StringVar(&Config.HTTPSCertFile, "http-tls-cert-file", "", "TLS certificate file for the HTTPs server") fs.StringVar(&Config.HTTPSCertFile, "http-tls-cert-file", "", "TLS certificate file for the HTTPs server")
// Bootstrapping: // Bootstrapping:
bootstrapIPs := fs.String("bootstrap-ips", "", "Comma separated list of bootstrap peer ips to connect to. Example: 127.0.0.1:9630,127.0.0.1:9631") bootstrapIPs := fs.String("bootstrap-ips", strings.Join(BootstrapIPs, ","), "Comma separated list of bootstrap peer ips to connect to. Example: 127.0.0.1:9630,127.0.0.1:9631")
bootstrapIDs := fs.String("bootstrap-ids", "", "Comma separated list of bootstrap peer ids to connect to. Example: JR4dVmy6ffUGAKCBDkyCbeZbyHQBeDsET,8CrVPQZ4VSqgL8zTdvL14G8HqAfrBr4z") bootstrapIDs := fs.String("bootstrap-ids", strings.Join(genesis.StakerIDs, ","), "Comma separated list of bootstrap peer ids to connect to. Example: JR4dVmy6ffUGAKCBDkyCbeZbyHQBeDsET,8CrVPQZ4VSqgL8zTdvL14G8HqAfrBr4z")
// Staking: // Staking:
consensusPort := fs.Uint("staking-port", 9651, "Port of the consensus server") consensusPort := fs.Uint("staking-port", 9651, "Port of the consensus server")