diff options
author | obscuren <geffobscura@gmail.com> | 2014-06-27 01:55:14 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-06-27 01:55:14 +0800 |
commit | 9d5a3f013121c319f9cf679d9afc4e40661a0284 (patch) | |
tree | f57ecbea40ca0354bb050d70a10851669412a581 /ethrpc/packages.go | |
parent | 3f1f8438ed8bf7b63ea5172090a5c7025cb093f0 (diff) | |
parent | a98e6a262a21ff08c28495bab5180a1c15826d40 (diff) | |
download | dexon-9d5a3f013121c319f9cf679d9afc4e40661a0284.tar dexon-9d5a3f013121c319f9cf679d9afc4e40661a0284.tar.gz dexon-9d5a3f013121c319f9cf679d9afc4e40661a0284.tar.bz2 dexon-9d5a3f013121c319f9cf679d9afc4e40661a0284.tar.lz dexon-9d5a3f013121c319f9cf679d9afc4e40661a0284.tar.xz dexon-9d5a3f013121c319f9cf679d9afc4e40661a0284.tar.zst dexon-9d5a3f013121c319f9cf679d9afc4e40661a0284.zip |
Merge branch 'release/0.5.15'
Diffstat (limited to 'ethrpc/packages.go')
-rw-r--r-- | ethrpc/packages.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ethrpc/packages.go b/ethrpc/packages.go index 1c4fb99f6..710275780 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()) + } + logger.Debugf("GetStorageAt(%s, %s)\n", args.Address, hx) value := state.GetStorage(hx) *reply = NewSuccessRes(GetStorageAtRes{Address: args.Address, Key: args.Key, Value: value}) return nil |