aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPulyak Viktor <pulyakviktor@gmail.com>2017-11-18 09:56:03 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-11-18 09:56:03 +0800
commitf5091e5711fc18205ed3a7c2d9d6a7fe7f0262f2 (patch)
treee763f716cb74bea070fd36f8625a63d1b367a564
parent0dbf55d478a1b228dbba354af346c428402e3154 (diff)
downloaddexon-f5091e5711fc18205ed3a7c2d9d6a7fe7f0262f2.tar.gz
dexon-f5091e5711fc18205ed3a7c2d9d6a7fe7f0262f2.tar.zst
dexon-f5091e5711fc18205ed3a7c2d9d6a7fe7f0262f2.zip
internal/ethapi: fix js tracer to properly decode addresses (#15297)
* Add method getBalanceFromJs for work with address as bytes * expect []byte instead of common.Address in ethapi tracer
-rw-r--r--internal/ethapi/tracer.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/ethapi/tracer.go b/internal/ethapi/tracer.go
index 051626527..fc742e6c4 100644
--- a/internal/ethapi/tracer.go
+++ b/internal/ethapi/tracer.go
@@ -130,28 +130,28 @@ type dbWrapper struct {
}
// getBalance retrieves an account's balance
-func (dw *dbWrapper) getBalance(addr common.Address) *big.Int {
- return dw.db.GetBalance(addr)
+func (dw *dbWrapper) getBalance(addr []byte) *big.Int {
+ return dw.db.GetBalance(common.BytesToAddress(addr))
}
// getNonce retrieves an account's nonce
-func (dw *dbWrapper) getNonce(addr common.Address) uint64 {
- return dw.db.GetNonce(addr)
+func (dw *dbWrapper) getNonce(addr []byte) uint64 {
+ return dw.db.GetNonce(common.BytesToAddress(addr))
}
// getCode retrieves an account's code
-func (dw *dbWrapper) getCode(addr common.Address) []byte {
- return dw.db.GetCode(addr)
+func (dw *dbWrapper) getCode(addr []byte) []byte {
+ return dw.db.GetCode(common.BytesToAddress(addr))
}
// getState retrieves an account's state data for the given hash
-func (dw *dbWrapper) getState(addr common.Address, hash common.Hash) common.Hash {
- return dw.db.GetState(addr, hash)
+func (dw *dbWrapper) getState(addr []byte, hash common.Hash) common.Hash {
+ return dw.db.GetState(common.BytesToAddress(addr), hash)
}
// exists returns true iff the account exists
-func (dw *dbWrapper) exists(addr common.Address) bool {
- return dw.db.Exist(addr)
+func (dw *dbWrapper) exists(addr []byte) bool {
+ return dw.db.Exist(common.BytesToAddress(addr))
}
// toValue returns an otto.Value for the dbWrapper