fix storageAt json-rpc endpoint

This commit is contained in:
ramil
2021-04-21 22:09:57 +03:00
parent 39141bd30d
commit cef4b1ddc6
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -660,7 +660,14 @@ func (pea *PublicEthAPI) localGetBalance(ctx context.Context, address common.Add
func (pea *PublicEthAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
storageVal, err := pea.B.GetStorageByNumberOrHash(ctx, address, common.HexToHash(key), blockNrOrHash)
if storageVal != nil && err == nil {
return storageVal, nil
var value common.Hash
_, content, _, err := rlp.Split(storageVal)
if err != nil {
return nil, err
}
value.SetBytes(content)
return value[:], nil
}
if pea.rpc != nil {
var res hexutil.Bytes