diff --git a/cmd/client/txgen/main.go b/cmd/client/txgen/main.go index 6cef61ea3..8f444f1aa 100644 --- a/cmd/client/txgen/main.go +++ b/cmd/client/txgen/main.go @@ -137,7 +137,7 @@ func main() { // Client/txgenerator server node setup consensusObj := consensus.New(host, "0", nil, p2p.Peer{}) clientNode := node.New(host, consensusObj, nil) - clientNode.Client = client.NewClient(clientNode.GetHost(), &shardIDLeaderMap) + clientNode.Client = client.NewClient(clientNode.GetHost(), shardIDLeaderMap) readySignal := make(chan uint32) go func() { diff --git a/cmd/client/wallet/lib/lib.go b/cmd/client/wallet/lib/lib.go index 70010d900..eeaee6899 100644 --- a/cmd/client/wallet/lib/lib.go +++ b/cmd/client/wallet/lib/lib.go @@ -44,14 +44,14 @@ func CreateWalletNode() *node.Node { } walletNode := node.New(host, nil, nil) - walletNode.Client = client.NewClient(walletNode.GetHost(), &shardIDLeaderMap) + walletNode.Client = client.NewClient(walletNode.GetHost(), shardIDLeaderMap) return walletNode } // SubmitTransaction submits the transaction to the Harmony network func SubmitTransaction(tx *types.Transaction, walletNode *node.Node, shardID uint32) error { msg := proto_node.ConstructTransactionListMessageAccount(types.Transactions{tx}) - leader := (*walletNode.Client.Leaders)[shardID] + leader := walletNode.Client.Leaders[shardID] walletNode.SendMessage(leader, msg) fmt.Printf("Transaction Id for shard %d: %s\n", int(shardID), tx.Hash().Hex()) time.Sleep(300 * time.Millisecond) diff --git a/cmd/client/wallet/lib/lib_test.go b/cmd/client/wallet/lib/lib_test.go index 033205603..e6710df1c 100644 --- a/cmd/client/wallet/lib/lib_test.go +++ b/cmd/client/wallet/lib/lib_test.go @@ -34,7 +34,7 @@ func TestSubmitTransaction(test *testing.T) { walletNode := node.New(m, nil, nil) priKey, _, _ := utils.GenKeyP2P("127.0.0.1", "9990") peerID, _ := peer.IDFromPrivateKey(priKey) - walletNode.Client = client.NewClient(walletNode.GetHost(), &map[uint32]p2p.Peer{0: p2p.Peer{IP: "127.0.0.1", Port: "9990", PeerID: peerID}}) + walletNode.Client = client.NewClient(walletNode.GetHost(), map[uint32]p2p.Peer{0: p2p.Peer{IP: "127.0.0.1", Port: "9990", PeerID: peerID}}) SubmitTransaction(&types.Transaction{}, walletNode, 0) diff --git a/cmd/client/wallet/main.go b/cmd/client/wallet/main.go index bd00f2bd3..e9a984c3a 100644 --- a/cmd/client/wallet/main.go +++ b/cmd/client/wallet/main.go @@ -308,7 +308,7 @@ func convertBalanceIntoReadableFormat(balance *big.Int) string { // FetchBalance fetches account balance of specified address from the Harmony network func FetchBalance(address common.Address, walletNode *node.Node) map[uint32]AccountState { result := make(map[uint32]AccountState) - for shardID, leader := range *walletNode.Client.Leaders { + for shardID, leader := range walletNode.Client.Leaders { port, _ := strconv.Atoi(leader.Port) client := clientService.NewClient(leader.IP, strconv.Itoa(port+node.ClientServicePortDiff)) response := client.GetBalance(address) @@ -321,7 +321,7 @@ func FetchBalance(address common.Address, walletNode *node.Node) map[uint32]Acco // GetFreeToken requests for token test token on each shard func GetFreeToken(address common.Address, walletNode *node.Node) { - for shardID, leader := range *walletNode.Client.Leaders { + for shardID, leader := range walletNode.Client.Leaders { port, _ := strconv.Atoi(leader.Port) client := clientService.NewClient(leader.IP, strconv.Itoa(port+node.ClientServicePortDiff)) response := client.GetFreeToken(address)