fix missing places

pull/423/head
Minh Doan 6 years ago committed by Minh Doan
parent a53670c4ae
commit e74788d6ef
  1. 2
      cmd/client/txgen/main.go
  2. 4
      cmd/client/wallet/lib/lib.go
  3. 2
      cmd/client/wallet/lib/lib_test.go
  4. 4
      cmd/client/wallet/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() {

@ -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)

@ -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)

@ -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)

Loading…
Cancel
Save