diff --git a/core/types/block.go b/core/types/block.go index b284fb3b1602..919008a12301 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -30,6 +30,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-verkle" ) @@ -367,6 +368,13 @@ func (b *Block) Uncles() []*Header { return b.uncles } func (b *Block) Transactions() Transactions { return b.transactions } func (b *Block) Withdrawals() Withdrawals { return b.withdrawals } +func (b *Block) BlobCount() uint64 { + if b.header.BlobGasUsed == nil { + return 0 + } + return *b.header.BlobGasUsed / params.BlobTxBlobGasPerBlob +} + func (b *Block) Transaction(hash common.Hash) *Transaction { for _, transaction := range b.transactions { if transaction.Hash() == hash {