core, graphql, internal: expose effectiveGasPrice in receipts

This commit is contained in:
Péter Szilágyi
2021-06-16 08:23:50 +03:00
parent 7a7abe3de8
commit aa69d36152
7 changed files with 42 additions and 8 deletions

View File

@ -1561,7 +1561,17 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha
"logsBloom": receipt.Bloom,
"type": hexutil.Uint(tx.Type()),
}
// Assign the effective gas price paid
if !s.b.ChainConfig().IsLondon(bigblock) {
fields["effectiveGasPrice"] = hexutil.Uint64(tx.GasPrice().Uint64())
} else {
header, err := s.b.HeaderByHash(ctx, blockHash)
if err != nil {
return nil, err
}
gasPrice := new(big.Int).Add(header.BaseFee, tx.EffectiveGasTipValue(header.BaseFee))
fields["effectiveGasPrice"] = hexutil.Uint64(gasPrice.Uint64())
}
// Assign receipt status or post state.
if len(receipt.PostState) > 0 {
fields["root"] = hexutil.Bytes(receipt.PostState)