aboutsummaryrefslogtreecommitdiffstats
path: root/ethrpc
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-25 23:13:27 +0800
committerzelig <viktor.tron@gmail.com>2014-06-25 23:13:27 +0800
commit4141cc39d0aa3956313aa4aa912ad81858f9bbc3 (patch)
tree4ada58c75c1d82fc65cb6ef4e6ec48e0c8604993 /ethrpc
parentf58c7ac5a6f5d77649c1c07dce94bf6d5c146c31 (diff)
parentd8c675afbf98178ffa447e4d36b77bbdad3f9ec0 (diff)
downloaddexon-4141cc39d0aa3956313aa4aa912ad81858f9bbc3.tar.gz
dexon-4141cc39d0aa3956313aa4aa912ad81858f9bbc3.tar.zst
dexon-4141cc39d0aa3956313aa4aa912ad81858f9bbc3.zip
Merge remote-tracking branch 'upstream/develop' into feature/logging
Diffstat (limited to 'ethrpc')
-rw-r--r--ethrpc/packages.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/ethrpc/packages.go b/ethrpc/packages.go
index 1c4fb99f6..3f57f6982 100644
--- a/ethrpc/packages.go
+++ b/ethrpc/packages.go
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"math/big"
+ "strings"
)
type EthereumApi struct {
@@ -174,9 +175,16 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageArgs, reply *string) error {
return err
}
state := p.ethp.GetStateObject(args.Address)
- // Convert the incoming string (which is a bigint) into hex
- i, _ := new(big.Int).SetString(args.Key, 10)
- hx := ethutil.Hex(i.Bytes())
+
+ var hx string
+ if strings.Index(args.Key, "0x") == 0 {
+ hx = string([]byte(args.Key)[2:])
+ } else {
+ // Convert the incoming string (which is a bigint) into hex
+ i, _ := new(big.Int).SetString(args.Key, 10)
+ hx = ethutil.Hex(i.Bytes())
+ }
+ ethutil.Config.Log.Debugf("[JSON] GetStorageAt(%s, %s)\n", args.Address, hx)
value := state.GetStorage(hx)
*reply = NewSuccessRes(GetStorageAtRes{Address: args.Address, Key: args.Key, Value: value})
return nil