@@ -59,10 +59,10 @@ type Receipt struct {
59
59
Logs []* Log `json:"logs" gencodec:"required"`
60
60
61
61
// Implementation fields: These fields are added by geth when processing a transaction.
62
- // They are stored in the chain database.
63
- TxHash common.Hash `json:"transactionHash" gencodec:"required "`
64
- ContractAddress common. Address `json:"contractAddress "`
65
- GasUsed uint64 `json:"gasUsed" gencodec:"required "`
62
+ TxHash common. Hash `json:"transactionHash" gencodec:"required"`
63
+ ContractAddress common.Address `json:"contractAddress "`
64
+ GasUsed uint64 `json:"gasUsed" gencodec:"required "`
65
+ EffectiveGasPrice * big. Int `json:"effectiveGasPrice "`
66
66
67
67
// Inclusion information: These fields provide information about the inclusion of the
68
68
// transaction corresponding to this receipt.
@@ -313,7 +313,7 @@ func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) {
313
313
314
314
// DeriveFields fills the receipts with their computed fields based on consensus
315
315
// data and contextual infos like containing block and transactions.
316
- func (rs Receipts ) DeriveFields (config * params.ChainConfig , hash common.Hash , number uint64 , txs Transactions ) error {
316
+ func (rs Receipts ) DeriveFields (config * params.ChainConfig , hash common.Hash , number uint64 , baseFee * big. Int , txs [] * Transaction ) error {
317
317
signer := MakeSigner (config , new (big.Int ).SetUint64 (number ))
318
318
319
319
logIndex := uint (0 )
@@ -325,6 +325,8 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu
325
325
rs [i ].Type = txs [i ].Type ()
326
326
rs [i ].TxHash = txs [i ].Hash ()
327
327
328
+ rs [i ].EffectiveGasPrice = txs [i ].inner .effectiveGasPrice (new (big.Int ), baseFee )
329
+
328
330
// block location fields
329
331
rs [i ].BlockHash = hash
330
332
rs [i ].BlockNumber = new (big.Int ).SetUint64 (number )
@@ -335,13 +337,17 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu
335
337
// Deriving the signer is expensive, only do if it's actually needed
336
338
from , _ := Sender (signer , txs [i ])
337
339
rs [i ].ContractAddress = crypto .CreateAddress (from , txs [i ].Nonce ())
340
+ } else {
341
+ rs [i ].ContractAddress = common.Address {}
338
342
}
343
+
339
344
// The used gas can be calculated based on previous r
340
345
if i == 0 {
341
346
rs [i ].GasUsed = rs [i ].CumulativeGasUsed
342
347
} else {
343
348
rs [i ].GasUsed = rs [i ].CumulativeGasUsed - rs [i - 1 ].CumulativeGasUsed
344
349
}
350
+
345
351
// The derived log fields can simply be set from the block and transaction
346
352
for j := 0 ; j < len (rs [i ].Logs ); j ++ {
347
353
rs [i ].Logs [j ].BlockNumber = number
0 commit comments