fixed rpc test failure in eth.blockNumber

This commit is contained in:
Bas van Kervel 2015-06-16 15:40:24 +02:00
parent 9ac1b4e59e
commit 3e1d635f8d

View File

@ -28,48 +28,49 @@ type ethhandler func(*ethApi, *shared.Request) (interface{}, error)
var ( var (
ethMapping = map[string]ethhandler{ ethMapping = map[string]ethhandler{
"eth_accounts": (*ethApi).Accounts, "eth_accounts": (*ethApi).Accounts,
"eth_blockNumber": (*ethApi).BlockNumber, "eth_blockNumber": (*ethApi).BlockNumber,
"eth_getBalance": (*ethApi).GetBalance, "eth_getBalance": (*ethApi).GetBalance,
"eth_protocolVersion": (*ethApi).ProtocolVersion, "eth_protocolVersion": (*ethApi).ProtocolVersion,
"eth_coinbase": (*ethApi).Coinbase, "eth_coinbase": (*ethApi).Coinbase,
"eth_mining": (*ethApi).IsMining, "eth_mining": (*ethApi).IsMining,
"eth_gasPrice": (*ethApi).GasPrice, "eth_gasPrice": (*ethApi).GasPrice,
"eth_getStorage": (*ethApi).GetStorage, "eth_getStorage": (*ethApi).GetStorage,
"eth_storageAt": (*ethApi).GetStorage, "eth_storageAt": (*ethApi).GetStorage,
"eth_getStorageAt": (*ethApi).GetStorageAt, "eth_getStorageAt": (*ethApi).GetStorageAt,
"eth_getTransactionCount": (*ethApi).GetTransactionCount, "eth_getTransactionCount": (*ethApi).GetTransactionCount,
"eth_getBlockTransactionCountByHash": (*ethApi).GetBlockTransactionCountByHash, "eth_getBlockTransactionCountByHash": (*ethApi).GetBlockTransactionCountByHash,
"eth_getBlockTransactionCountByNumber": (*ethApi).GetBlockTransactionCountByNumber, "eth_getBlockTransactionCountByNumber": (*ethApi).GetBlockTransactionCountByNumber,
"eth_getUncleCountByBlockHash": (*ethApi).GetUncleCountByBlockHash, "eth_getUncleCountByBlockHash": (*ethApi).GetUncleCountByBlockHash,
"eth_getUncleCountByBlockNumber": (*ethApi).GetUncleCountByBlockNumber, "eth_getUncleCountByBlockNumber": (*ethApi).GetUncleCountByBlockNumber,
"eth_getData": (*ethApi).GetData, "eth_getData": (*ethApi).GetData,
"eth_getCode": (*ethApi).GetData, "eth_getCode": (*ethApi).GetData,
"eth_sign": (*ethApi).Sign, "eth_sign": (*ethApi).Sign,
"eth_sendRawTransaction": (*ethApi).PushTx, "eth_sendRawTransaction": (*ethApi).PushTx,
"eth_sendTransaction": (*ethApi).SendTransaction, "eth_sendTransaction": (*ethApi).SendTransaction,
"eth_transact": (*ethApi).SendTransaction, "eth_transact": (*ethApi).SendTransaction,
"eth_estimateGas": (*ethApi).EstimateGas, "eth_estimateGas": (*ethApi).EstimateGas,
"eth_call": (*ethApi).Call, "eth_call": (*ethApi).Call,
"eth_flush": (*ethApi).Flush, "eth_flush": (*ethApi).Flush,
"eth_getBlockByHash": (*ethApi).GetBlockByHash, "eth_getBlockByHash": (*ethApi).GetBlockByHash,
"eth_getBlockByNumber": (*ethApi).GetBlockByNumber, "eth_getBlockByNumber": (*ethApi).GetBlockByNumber,
"eth_getTransactionByHash": (*ethApi).GetTransactionByHash, "eth_getTransactionByHash": (*ethApi).GetTransactionByHash,
"eth_getTransactionByBlockHashAndIndex": (*ethApi).GetTransactionByBlockHashAndIndex, "eth_getTransactionByBlockNumberAndIndex": (*ethApi).GetTransactionByBlockNumberAndIndex,
"eth_getUncleByBlockHashAndIndex": (*ethApi).GetUncleByBlockHashAndIndex, "eth_getTransactionByBlockHashAndIndex": (*ethApi).GetTransactionByBlockHashAndIndex,
"eth_getUncleByBlockNumberAndIndex": (*ethApi).GetUncleByBlockNumberAndIndex, "eth_getUncleByBlockHashAndIndex": (*ethApi).GetUncleByBlockHashAndIndex,
"eth_getCompilers": (*ethApi).GetCompilers, "eth_getUncleByBlockNumberAndIndex": (*ethApi).GetUncleByBlockNumberAndIndex,
"eth_compileSolidity": (*ethApi).CompileSolidity, "eth_getCompilers": (*ethApi).GetCompilers,
"eth_newFilter": (*ethApi).NewFilter, "eth_compileSolidity": (*ethApi).CompileSolidity,
"eth_newBlockFilter": (*ethApi).NewBlockFilter, "eth_newFilter": (*ethApi).NewFilter,
"eth_newPendingTransactionFilter": (*ethApi).NewPendingTransactionFilter, "eth_newBlockFilter": (*ethApi).NewBlockFilter,
"eth_uninstallFilter": (*ethApi).UninstallFilter, "eth_newPendingTransactionFilter": (*ethApi).NewPendingTransactionFilter,
"eth_getFilterChanges": (*ethApi).GetFilterChanges, "eth_uninstallFilter": (*ethApi).UninstallFilter,
"eth_getFilterLogs": (*ethApi).GetFilterLogs, "eth_getFilterChanges": (*ethApi).GetFilterChanges,
"eth_getLogs": (*ethApi).GetLogs, "eth_getFilterLogs": (*ethApi).GetFilterLogs,
"eth_hashrate": (*ethApi).Hashrate, "eth_getLogs": (*ethApi).GetLogs,
"eth_getWork": (*ethApi).GetWork, "eth_hashrate": (*ethApi).Hashrate,
"eth_submitWork": (*ethApi).SubmitWork, "eth_getWork": (*ethApi).GetWork,
"eth_submitWork": (*ethApi).SubmitWork,
} }
) )
@ -115,7 +116,8 @@ func (self *ethApi) Hashrate(req *shared.Request) (interface{}, error) {
} }
func (self *ethApi) BlockNumber(req *shared.Request) (interface{}, error) { func (self *ethApi) BlockNumber(req *shared.Request) (interface{}, error) {
return self.xeth.CurrentBlock().Number(), nil num := self.xeth.CurrentBlock().Number()
return newHexNum(num.Bytes()), nil
} }
func (self *ethApi) GetBalance(req *shared.Request) (interface{}, error) { func (self *ethApi) GetBalance(req *shared.Request) (interface{}, error) {