evm: error and block hash map updates (#60)

* evm: error and block hash map updates

* evm: update tests
This commit is contained in:
Federico Kunze
2021-05-31 10:54:59 -04:00
committed by GitHub
parent 9a5654f70d
commit abcfc9a6ba
22 changed files with 395 additions and 864 deletions
+7 -5
View File
@@ -678,12 +678,14 @@ func (e *PublicEthAPI) GetTransactionByHash(hash common.Hash) (*rpctypes.RPCTran
func (e *PublicEthAPI) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) {
e.logger.Debugln("eth_getTransactionByHashAndIndex", "hash", hash.Hex(), "index", idx)
resp, err := e.queryClient.TxReceiptsByBlockHash(e.ctx, &evmtypes.QueryTxReceiptsByBlockHashRequest{
Hash: hash.Hex(),
})
header, err := e.backend.HeaderByHash(hash)
if err != nil {
err = errors.Wrap(err, "failed to query tx receipts by block hash")
return nil, err
return nil, errors.Wrapf(err, "failed retrieve block from hash")
}
resp, err := e.queryClient.TxReceiptsByBlockHeight(rpctypes.ContextWithHeight(header.Number.Int64()), &evmtypes.QueryTxReceiptsByBlockHeightRequest{})
if err != nil {
return nil, errors.Wrap(err, "failed to query tx receipts by block height")
}
return e.getReceiptByIndex(resp.Receipts, hash, idx)