forked from cerc-io/laconicd-deprecated
evm: error and block hash map updates (#60)
* evm: error and block hash map updates * evm: update tests
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user