diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-27 05:24:48 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-27 05:24:48 +0800 |
commit | 2c5a32ebbc60f23e609c8397dad5d09ee38b69bb (patch) | |
tree | f3032df9df2a1b1abfac2a0aaae58f0b2125b54f | |
parent | 1f3814141b94166cc5bf5b439babe6cc56b3cebf (diff) | |
download | go-tangerine-2c5a32ebbc60f23e609c8397dad5d09ee38b69bb.tar go-tangerine-2c5a32ebbc60f23e609c8397dad5d09ee38b69bb.tar.gz go-tangerine-2c5a32ebbc60f23e609c8397dad5d09ee38b69bb.tar.bz2 go-tangerine-2c5a32ebbc60f23e609c8397dad5d09ee38b69bb.tar.lz go-tangerine-2c5a32ebbc60f23e609c8397dad5d09ee38b69bb.tar.xz go-tangerine-2c5a32ebbc60f23e609c8397dad5d09ee38b69bb.tar.zst go-tangerine-2c5a32ebbc60f23e609c8397dad5d09ee38b69bb.zip |
Undo XEth changes
-rw-r--r-- | rpc/api.go | 14 | ||||
-rw-r--r-- | xeth/xeth.go | 7 |
2 files changed, 9 insertions, 12 deletions
diff --git a/rpc/api.go b/rpc/api.go index ad48b8607..339de4432 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -126,7 +126,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - block := NewBlockRes(api.xeth().EthBlockByHash(args.BlockHash)) + block := NewBlockRes(api.xeth().EthBlockByHash(args.BlockHash.Hex())) *reply = common.ToHex(big.NewInt(int64(len(block.Transactions))).Bytes()) case "eth_getBlockTransactionCountByNumber": args := new(GetBlockByNumberArgs) @@ -142,7 +142,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - block := api.xeth().EthBlockByHash(args.BlockHash) + block := api.xeth().EthBlockByHash(args.BlockHash.Hex()) br := NewBlockRes(block) *reply = common.ToHex(big.NewInt(int64(len(br.Uncles))).Bytes()) case "eth_getUncleCountByBlockNumber": @@ -191,7 +191,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - block := api.xeth().EthBlockByHash(args.BlockHash) + block := api.xeth().EthBlockByHash(args.BlockHash.Hex()) br := NewBlockRes(block) br.fullTx = args.IncludeTxs @@ -222,7 +222,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - block := api.xeth().EthBlockByHash(args.Hash) + block := api.xeth().EthBlockByHash(args.Hash.Hex()) br := NewBlockRes(block) br.fullTx = true @@ -250,14 +250,14 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err return err } - br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash)) + br := NewBlockRes(api.xeth().EthBlockByHash(args.Hash.Hex())) if args.Index > int64(len(br.Uncles)) || args.Index < 0 { return NewValidationError("Index", "does not exist") } uhash := br.Uncles[args.Index].Hex() - uncle := NewBlockRes(api.xeth().EthBlockByHexstring(uhash)) + uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash)) *reply = uncle case "eth_getUncleByBlockNumberAndIndex": @@ -275,7 +275,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err } uhash := v.Uncles[args.Index].Hex() - uncle := NewBlockRes(api.xeth().EthBlockByHexstring(uhash)) + uncle := NewBlockRes(api.xeth().EthBlockByHash(uhash)) *reply = uncle case "eth_getCompilers": diff --git a/xeth/xeth.go b/xeth/xeth.go index 92e73c7d5..bf30fc2fc 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -160,16 +160,13 @@ func (self *XEth) BlockByHash(strHash string) *Block { return NewBlock(block) } -func (self *XEth) EthBlockByHash(hash common.Hash) *types.Block { +func (self *XEth) EthBlockByHash(strHash string) *types.Block { + hash := common.HexToHash(strHash) block := self.backend.ChainManager().GetBlock(hash) return block } -func (self *XEth) EthBlockByHexstring(strHash string) *types.Block { - return self.EthBlockByHash(common.HexToHash(strHash)) -} - func (self *XEth) EthTransactionByHash(hash string) *types.Transaction { data, _ := self.backend.ExtraDb().Get(common.FromHex(hash)) if len(data) != 0 { |