From e18b96b486abefb587fd93cfe33fe6edcd8cbb87 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 6 May 2014 14:15:02 +0200 Subject: [PATCH 1/2] Fix an issue where we don't have the rpc so we dont have to close it --- ethereum.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethereum.go b/ethereum.go index 707938639..2f4db7336 100644 --- a/ethereum.go +++ b/ethereum.go @@ -339,7 +339,9 @@ func (s *Ethereum) Stop() { close(s.quit) - s.RpcServer.Stop() + if s.RpcServer != nil { + s.RpcServer.Stop() + } s.txPool.Stop() s.stateManager.Stop() From 050684450befaac8972120688b69825e8f0acbca Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 6 May 2014 17:04:52 +0200 Subject: [PATCH 2/2] Assume arguments are supplied as strings to the rpc interface --- ethrpc/packages.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ethrpc/packages.go b/ethrpc/packages.go index b989a65cb..4ec2b4602 100644 --- a/ethrpc/packages.go +++ b/ethrpc/packages.go @@ -4,7 +4,8 @@ import ( "encoding/json" "errors" "github.com/ethereum/eth-go/ethpub" - _ "log" + "github.com/ethereum/eth-go/ethutil" + "math/big" ) type EthereumApi struct { @@ -173,7 +174,10 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageArgs, reply *string) error { return err } state := p.ethp.GetStateObject(args.Address) - value := state.GetStorage(args.Key) + // Convert the incoming string (which is a bigint) into hex + i, _ := new(big.Int).SetString(args.Key, 10) + hx := ethutil.Hex(i.Bytes()) + value := state.GetStorage(hx) *reply = NewSuccessRes(GetStorageAtRes{Address: args.Address, Key: args.Key, Value: value}) return nil }