[wallet] use random port to avoid .dht file conflict

Signed-off-by: Leo Chen <leo@harmony.one>
pull/1511/head
Leo Chen 5 years ago
parent d2b3e8c340
commit 54339667ed
  1. 9
      cmd/client/wallet/main.go

@ -290,8 +290,9 @@ func createWalletNode() *node.Node {
// dummy host for wallet
// TODO: potentially, too many dummy IP may flush out good IP address from our bootnode DHT
// we need to understand the impact to bootnode DHT with this dummy host ip added
self := p2p.Peer{IP: "127.0.0.1", Port: "6999"}
priKey, _, _ := utils.GenKeyP2P("127.0.0.1", "6999")
port := fmt.Sprintf("%d", 16999+rand.Intn(1000))
self := p2p.Peer{IP: "127.0.0.1", Port: port}
priKey, _, _ := utils.GenKeyP2P("127.0.0.1", port)
host, err := p2pimpl.NewHost(&self, priKey)
if err != nil {
panic(err)
@ -688,8 +689,6 @@ func processTransferCommand() {
return
}
walletNode := createWalletNode()
shardIDToAccountState := FetchBalance(senderAddress)
state := shardIDToAccountState[shardID]
@ -705,6 +704,8 @@ func processTransferCommand() {
return
}
walletNode := createWalletNode()
amountBigInt := big.NewInt(int64(amount * denominations.Nano))
amountBigInt = amountBigInt.Mul(amountBigInt, big.NewInt(denominations.Nano))
gas, err := core.IntrinsicGas(inputData, false, true)

Loading…
Cancel
Save