Add status field for pre-byzantium blocks.

This commit is contained in:
Arijit Das
2021-09-14 17:25:48 +05:30
parent 458aae1c1e
commit 04a0f9a751
14 changed files with 258 additions and 121 deletions
+8 -2
View File
@@ -524,12 +524,18 @@ func (pea *PublicEthAPI) localGetTransactionReceipt(ctx context.Context, hash co
"logsBloom": receipt.Bloom,
}
// Assign receipt status or post state.
if len(receipt.PostState) > 0 {
if blockNumber <= pea.B.Config.ChainConfig.ByzantiumBlock.Uint64() {
if receipt.GasUsed > tx.Gas() {
fields["status"] = hexutil.Uint(types.ReceiptStatusFailed)
} else {
fields["status"] = hexutil.Uint(types.ReceiptStatusSuccessful)
}
} else if len(receipt.PostState) > 0 {
fields["root"] = hexutil.Bytes(receipt.PostState)
} else {
fields["status"] = hexutil.Uint(receipt.Status)
}
if receipt.Logs == nil {
fields["logs"] = []*types.Log{}
}