From a6a9b4e81e494d8754366cc1d9b6b800677d2a62 Mon Sep 17 00:00:00 2001 From: Miguel Montes <miguel.montes@gmail.com> Date: Mon, 3 Dec 2018 17:58:39 -0300 Subject: [PATCH] =?UTF-8?q?Cambio=20de=20tipo=20del=20argumento=20de=20los?= =?UTF-8?q?=20m=C3=A9todos=20Balance=20y=20BalanceAtBlock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bfa_client/src/bfa/node.go | 6 +++--- bfa_client/src/client/bfa_client.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bfa_client/src/bfa/node.go b/bfa_client/src/bfa/node.go index 6d11f47..c0b66fe 100644 --- a/bfa_client/src/bfa/node.go +++ b/bfa_client/src/bfa/node.go @@ -259,13 +259,13 @@ func (node *Node) PeerCount() uint64 { return uint64(peerCount) } -func (node *Node) BalanceAtBlock(account string, blockNumber int64) *big.Int { +func (node *Node) BalanceAtBlock(account common.Address, blockNumber int64) *big.Int { var balance BigInt node.Call(&balance, "eth_getBalance", account, hexBlockNumber(blockNumber)) return (*big.Int)(&balance) } -func (node *Node) Balance(account string) *big.Int { +func (node *Node) Balance(account common.Address) *big.Int { return node.BalanceAtBlock(account, -1) } @@ -430,7 +430,7 @@ func (node *Node) SealersStatus(blockNumber int64) (status map[string]*SealerSta status = make(map[string]*SealerStatus) for _, address := range node.SealersAtBlock(blockNumber) { status[address] = &SealerStatus{ - Balance: node.BalanceAtBlock(address, blockNumber), + Balance: node.BalanceAtBlock(common.HexToAddress(address), blockNumber), } } notSeen := int64(len(status)) diff --git a/bfa_client/src/client/bfa_client.go b/bfa_client/src/client/bfa_client.go index 68429b3..f3f25ac 100644 --- a/bfa_client/src/client/bfa_client.go +++ b/bfa_client/src/client/bfa_client.go @@ -5,6 +5,7 @@ import ( "../util" "flag" "fmt" + "github.com/ethereum/go-ethereum/common" "log" "math/big" "os" @@ -380,7 +381,7 @@ func status() { util.Check(err) defer node.Close() for _, account := range node.Accounts() { - nodeStatus.Accounts[account] = node.Balance(account) + nodeStatus.Accounts[account] = node.Balance(common.HexToAddress(account)) } nodeStatus.Coinbase, _ = node.Coinbase() nodeStatus.BlockNumber = node.BlockNumber() -- GitLab