Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions evmrpc/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,17 @@ func getTransactionReceipt(
}
return nil, err
}
// Fetch block once — used both for ante-failure receipt population and encoding.
height := int64(receipt.BlockNumber) //nolint:gosec
block, err := blockByNumberRespectingWatermarks(ctx, t.tmClient, t.watermarks, &height, 1)
if err != nil {
return nil, err
}

// Fill in the receipt if the transaction has failed and used 0 gas
// This case is for when a tx fails before it makes it to the VM
if receipt.Status == 0 && receipt.GasUsed == 0 {
receipt = cloneReceiptForMutation(receipt)
// Get the block
height := int64(receipt.BlockNumber) //nolint:gosec
block, err := blockByNumberRespectingWatermarks(ctx, t.tmClient, t.watermarks, &height, 1)
if err != nil {
return nil, err
}

// Find the transaction in the block
for _, tx := range block.Block.Txs {
Expand All @@ -168,11 +169,6 @@ func getTransactionReceipt(
}
}
}
height := int64(receipt.BlockNumber) //nolint:gosec
block, err := blockByNumberRespectingWatermarks(ctx, t.tmClient, t.watermarks, &height, 1)
if err != nil {
return nil, err
}
return encodeReceipt(t.ctxProvider, t.txConfigProvider, receipt, t.keeper, block, includeSynthetic, t.globalBlockCache, t.cacheCreationMutex)
}

Expand Down
Loading