Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion cmd/cql/internal/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ or input a passphrase by
DebugFlag: flag.NewFlagSet("Debug params", flag.ExitOnError),
}

const (
testnetCN = "cn"
testnetW = "w"
)

var (
privateKeyParam string
source string
minerListenAddr string
testnetRegion string
)

func init() {
Expand All @@ -70,7 +76,9 @@ func init() {
CmdGenerate.Flag.StringVar(&source, "source", "",
"Generate config using the specified config template")
CmdGenerate.Flag.StringVar(&minerListenAddr, "miner", "",
"Generate miner config with specified miner address")
"Generate miner config with specified miner address. Conflict with -source param")
CmdGenerate.Flag.StringVar(&testnetRegion, "testnet", testnetCN,
"Generate config using the specified testnet region: cn or w. Default cn. Conflict with -source param")

addCommonFlags(CmdGenerate)
}
Expand Down Expand Up @@ -167,14 +175,22 @@ func runGenerate(cmd *Command, args []string) {
var rawConfig *conf.Config

if source == "" {
fmt.Printf("Generating testnet %s config\n", testnetRegion)

// Load testnet config
rawConfig = testnet.GetTestNetConfig()
if minerListenAddr != "" {
testnet.SetMinerConfig(rawConfig)
rawConfig.ListenAddr = "0.0.0.0:" + port
}

if testnetRegion == testnetW {
rawConfig.DNSSeed.BPCount = 3
rawConfig.DNSSeed.Domain = "testnetw.gridb.io"
}
} else {
// Load from template file
fmt.Printf("Generating config base on %s templete\n", source)
sourceConfig, err := ioutil.ReadFile(source)
if err != nil {
ConsoleLog.WithError(err).Error("read config template failed")
Expand Down
34 changes: 34 additions & 0 deletions conf/testnet/w/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
WorkingRoot: ""
PubKeyStoreFile: ""
PrivateKeyFile: private.key
WalletAddress: 29f96a13b3b587e061f4d4bdcbee31073d6ad83f9cec650004164405ec991494
DHTFileName: ""
ListenAddr: ""
ThisNodeID: 000000e8186de2cac97b6d1ce03e80c546d4c34402e812afccb969e8a9324923
ValidDNSKeys: {}
MinNodeIDDifficulty: 0
DNSSeed:
EnforcedDNSSEC: false
DNSServers: []
Domain: testnetw.gridb.io
BPCount: 3
BlockProducer: null
KnownNodes:
- ID: 000000e8186de2cac97b6d1ce03e80c546d4c34402e812afccb969e8a9324923
Role: Client
Addr: 0.0.0.0:15151
PublicKey: 036619f08e0c7f4c311e54cf2462a7b7f984d4eb722b02253108437394038beb3e
Nonce:
a: 5998476
b: 0
c: 0
d: 3636533164
QPS: 0
ChainBusPeriod: 0s
BillingBlockCount: 0
BPPeriod: 0s
BPTick: 0s
SQLChainPeriod: 1m0s
SQLChainTick: 0s
SQLChainTTL: 0
MinProviderDeposit: 0
1 change: 1 addition & 0 deletions conf/testnet/w/private.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MZPcwtchLg7PamjM8RKgPbBk1PMcv9D5RYARv8un9Zx4be3se8Pwz7s4PqR3kvDMiYrkXYZVWKah1rUGBY91ja1ofRoc7z
File renamed without changes.
4 changes: 2 additions & 2 deletions route/ipv6seed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ func TestGenTestNetDomain(t *testing.T) {
}
}
})
Convey("generate testnet sydney domain", t, func() {
Convey("generate testnet w domain", t, func() {
log.SetLevel(log.DebugLevel)
var (
baseDir = utils.GetProjectSrcDir()
testnetConf = utils.FJ(baseDir, "./conf/testnet/testnet-sydney-bp.yaml")
testnetConf = utils.FJ(baseDir, "./conf/testnet/w/testnet-w-bp.yaml")
)

conf, err := conf.LoadConfig(testnetConf)
Expand Down