core/types: add 4844 data gas fields in Receipt (#27743)
* core/types: add data gas fields in Receipt * core/types: use BlobGas method of tx * core: fix test * core/types: fix receipt tests, add data gas used field test --------- Co-authored-by: Péter Szilágyi <peterke@gmail.com>
This commit is contained in:
co-authored by
Péter Szilágyi
parent
1662228ac6
commit
393d4db18c
+8
-1
@@ -23,6 +23,7 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/txpool"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
@@ -175,7 +176,13 @@ func GetBlockReceipts(ctx context.Context, odr OdrBackend, hash common.Hash, num
|
||||
genesis := rawdb.ReadCanonicalHash(odr.Database(), 0)
|
||||
config := rawdb.ReadChainConfig(odr.Database(), genesis)
|
||||
|
||||
if err := receipts.DeriveFields(config, block.Hash(), block.NumberU64(), block.Time(), block.BaseFee(), block.Transactions()); err != nil {
|
||||
var dataGasPrice *big.Int
|
||||
excessDataGas := block.ExcessDataGas()
|
||||
if excessDataGas != nil {
|
||||
dataGasPrice = eip4844.CalcBlobFee(*excessDataGas)
|
||||
}
|
||||
|
||||
if err := receipts.DeriveFields(config, block.Hash(), block.NumberU64(), block.Time(), block.BaseFee(), dataGasPrice, block.Transactions()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rawdb.WriteReceipts(odr.Database(), hash, number, receipts)
|
||||
|
||||
Reference in New Issue
Block a user