diff --git a/cmd/rpcdaemon/commands/eth_receipts.go b/cmd/rpcdaemon/commands/eth_receipts.go index 24ea874bd9a..d313564ce05 100644 --- a/cmd/rpcdaemon/commands/eth_receipts.go +++ b/cmd/rpcdaemon/commands/eth_receipts.go @@ -676,7 +676,7 @@ func (api *APIImpl) GetTransactionReceipt(ctx context.Context, txnHash common.Ha return nil, fmt.Errorf("block has less receipts than expected: %d <= %d, block: %d", len(receipts), int(txnIndex), blockNum) } - return marshalReceipt(receipts[txnIndex], block.Transactions()[txnIndex], cc, block.HeaderNoCopy(), txnHash, true), nil + return api.addEffectiveGasPercentage(marshalReceipt(receipts[txnIndex], txn, cc, block.HeaderNoCopy(), txnHash, true), tx, txn) } // GetBlockReceipts - receipts for individual block diff --git a/cmd/rpcdaemon/commands/eth_receipts_zkevm.go b/cmd/rpcdaemon/commands/eth_receipts_zkevm.go new file mode 100644 index 00000000000..d79a5919907 --- /dev/null +++ b/cmd/rpcdaemon/commands/eth_receipts_zkevm.go @@ -0,0 +1,16 @@ +package commands + +import ( + "github.com/ledgerwatch/erigon-lib/kv" + "github.com/ledgerwatch/erigon/core" + "github.com/ledgerwatch/erigon/core/types" +) + +func (api *APIImpl) addEffectiveGasPercentage(fields map[string]interface{}, tx kv.Tx, txn types.Transaction) (map[string]interface{}, error) { + effectiveGasPricePercentage, err := api.getEffectiveGasPricePercentage(tx, txn.Hash()) + if err != nil { + return nil, err + } + fields["effectiveGasPrice"] = core.CalculateEffectiveGas(txn.GetPrice(), effectiveGasPricePercentage) + return fields, nil +}