diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-20 07:58:59 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-20 07:58:59 +0800 |
commit | 6cc02aadbff9c37cc623fadb21029527a11a06f4 (patch) | |
tree | 0a8917a6613d181b91c54e21acd900fe2d96fc10 /rpc/api.go | |
parent | abc3d8d50a8691d9b4c2bd047807908d157e223c (diff) | |
download | go-tangerine-6cc02aadbff9c37cc623fadb21029527a11a06f4.tar.gz go-tangerine-6cc02aadbff9c37cc623fadb21029527a11a06f4.tar.zst go-tangerine-6cc02aadbff9c37cc623fadb21029527a11a06f4.zip |
Inline getStateWithNum
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/rpc/api.go b/rpc/api.go index d00b86ac0..7fc8f32e2 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -81,10 +81,6 @@ func (self *EthereumApi) xethWithStateNum(num int64) *xeth.XEth { return self.xeth().WithState(st) } -func (self *EthereumApi) getStateWithNum(num int64) *xeth.State { - return self.xethWithStateNum(num).State() -} - func (self *EthereumApi) start() { timer := time.NewTicker(filterTickerTime) done: @@ -290,8 +286,7 @@ func (p *EthereumApi) GetBalance(args *GetBalanceArgs, reply *interface{}) error if err := args.requirements(); err != nil { return err } - state := p.getStateWithNum(args.BlockNumber).SafeGet(args.Address) - *reply = common.ToHex(state.Balance().Bytes()) + *reply = common.ToHex(p.xethWithStateNum(args.BlockNumber).State().SafeGet(args.Address).Balance().Bytes()) return nil } @@ -299,7 +294,7 @@ func (p *EthereumApi) GetStorage(args *GetStorageArgs, reply *interface{}) error if err := args.requirements(); err != nil { return err } - *reply = p.getStateWithNum(args.BlockNumber).SafeGet(args.Address).Storage() + *reply = p.xethWithStateNum(args.BlockNumber).State().SafeGet(args.Address).Storage() return nil } @@ -307,9 +302,10 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageAtArgs, reply *interface{}) e if err := args.requirements(); err != nil { return err } - state := p.getStateWithNum(args.BlockNumber).SafeGet(args.Address) + state := p.xethWithStateNum(args.BlockNumber).State().SafeGet(args.Address) value := state.StorageString(args.Key) + var hx string if strings.Index(args.Key, "0x") == 0 { hx = string([]byte(args.Key)[2:]) |