[wallet] fix wallet with network type support

Signed-off-by: Leo Chen <leo@harmony.one>
pull/1730/head
Leo Chen 5 years ago
parent 2ecd3a6286
commit 79418c68bc
  1. 4
      .hmy/wallet.ini
  2. 4
      cmd/client/wallet/generated_wallet.ini.go
  3. 3
      cmd/client/wallet/main.go
  4. 4
      cmd/client/wallet_stress_test/generated_wallet.ini.go
  5. 6
      internal/utils/configfile.go

@ -5,6 +5,7 @@ bootnode = /ip4/54.213.43.194/tcp/9874/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHN
bootnode = /ip4/13.113.101.219/tcp/12019/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX
bootnode = /ip4/99.81.170.167/tcp/12019/p2p/QmRVbTpEYup8dSaURZfF6ByrMTSKa4UyUzJhSjahFzRqNj
shards = 4
network = mainnet
[main.shard0.rpc]
rpc = l0.t.hmny.io:14555
@ -26,6 +27,7 @@ rpc = s3.t.hmny.io:14555
chain_id = 2
bootnode = /ip4/127.0.0.1/tcp/19876/p2p/Qmc1V6W7BwX8Ugb42Ti8RnXF1rY5PF7nnZ6bKBryCgi6cv
shards = 2
network = localnet
[local.shard0.rpc]
rpc = 127.0.0.1:14555
@ -43,6 +45,7 @@ bootnode = /ip4/54.213.43.194/tcp/9868/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHN
bootnode = /ip4/100.26.90.187/tcp/9868/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
bootnode = /ip4/13.113.101.219/tcp/12018/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX
shards = 2
network = testnet
[beta.shard0.rpc]
rpc = l0.b.hmny.io:14555
@ -57,6 +60,7 @@ chain_id = 3
bootnode = /ip4/54.86.126.90/tcp/9889/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
bootnode = /ip4/52.40.84.2/tcp/9889/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9
shards = 4
network = pangaea
[pangaea.shard0.rpc]
rpc = l0.p.hmny.io:14555

@ -8,6 +8,7 @@ bootnode = /ip4/54.213.43.194/tcp/9874/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHN
bootnode = /ip4/13.113.101.219/tcp/12019/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX
bootnode = /ip4/99.81.170.167/tcp/12019/p2p/QmRVbTpEYup8dSaURZfF6ByrMTSKa4UyUzJhSjahFzRqNj
shards = 4
network = mainnet
[main.shard0.rpc]
rpc = l0.t.hmny.io:14555
@ -29,6 +30,7 @@ rpc = s3.t.hmny.io:14555
chain_id = 2
bootnode = /ip4/127.0.0.1/tcp/19876/p2p/Qmc1V6W7BwX8Ugb42Ti8RnXF1rY5PF7nnZ6bKBryCgi6cv
shards = 2
network = localnet
[local.shard0.rpc]
rpc = 127.0.0.1:14555
@ -46,6 +48,7 @@ bootnode = /ip4/54.213.43.194/tcp/9868/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHN
bootnode = /ip4/100.26.90.187/tcp/9868/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
bootnode = /ip4/13.113.101.219/tcp/12018/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX
shards = 2
network = testnet
[beta.shard0.rpc]
rpc = l0.b.hmny.io:14555
@ -60,6 +63,7 @@ chain_id = 3
bootnode = /ip4/54.86.126.90/tcp/9889/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
bootnode = /ip4/52.40.84.2/tcp/9889/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9
shards = 4
network = pangaea
[pangaea.shard0.rpc]
rpc = l0.p.hmny.io:14555

@ -123,6 +123,7 @@ var (
)
var (
networkType string
walletProfile *utils.WalletProfile
ks *keystore.KeyStore
)
@ -307,6 +308,8 @@ func createWalletNode() *node.Node {
w.Client = client.NewClient(w.GetHost(), uint32(shardID))
w.NodeConfig.SetRole(nodeconfig.ClientNode)
netType := nodeconfig.NetworkType(walletProfile.Network)
nodeconfig.SetNetworkType(netType)
w.ServiceManagerSetup()
w.RunServices()
return w

@ -8,6 +8,7 @@ bootnode = /ip4/54.213.43.194/tcp/9874/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHN
bootnode = /ip4/13.113.101.219/tcp/12019/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX
bootnode = /ip4/99.81.170.167/tcp/12019/p2p/QmRVbTpEYup8dSaURZfF6ByrMTSKa4UyUzJhSjahFzRqNj
shards = 4
network = mainnet
[main.shard0.rpc]
rpc = l0.t.hmny.io:14555
@ -29,6 +30,7 @@ rpc = s3.t.hmny.io:14555
chain_id = 2
bootnode = /ip4/127.0.0.1/tcp/19876/p2p/Qmc1V6W7BwX8Ugb42Ti8RnXF1rY5PF7nnZ6bKBryCgi6cv
shards = 2
network = localnet
[local.shard0.rpc]
rpc = 127.0.0.1:14555
@ -46,6 +48,7 @@ bootnode = /ip4/54.213.43.194/tcp/9868/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHN
bootnode = /ip4/100.26.90.187/tcp/9868/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
bootnode = /ip4/13.113.101.219/tcp/12018/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX
shards = 2
network = testnet
[beta.shard0.rpc]
rpc = l0.b.hmny.io:14555
@ -60,6 +63,7 @@ chain_id = 3
bootnode = /ip4/54.86.126.90/tcp/9889/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
bootnode = /ip4/52.40.84.2/tcp/9889/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9
shards = 4
network = pangaea
[pangaea.shard0.rpc]
rpc = l0.p.hmny.io:14555

@ -19,6 +19,7 @@ type WalletProfile struct {
Bootnodes []string
Shards int
RPCServer [][]p2p.Peer
Network string
}
// ReadWalletProfile reads an ini file and return WalletProfile
@ -42,6 +43,11 @@ func ReadWalletProfile(iniBytes []byte, profile string) (*WalletProfile, error)
} else {
return nil, fmt.Errorf("can't find bootnode key")
}
if sec.HasKey("network") {
config.Network = sec.Key("network").String()
} else {
config.Network = "devnet"
}
if sec.HasKey("chain_id") {
config.ChainID = sec.Key("chain_id").String()
} else {

Loading…
Cancel
Save