mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 16:59:26 +00:00
core/txpool/blobpool: expose storage sizes
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
4d532c2edc
commit
e273770c67
2 changed files with 22 additions and 6 deletions
|
|
@ -346,9 +346,10 @@ type BlobPool struct {
|
|||
reserver txpool.Reserver // Address reserver to ensure exclusivity across subpools
|
||||
hasPendingAuth func(common.Address) bool // Determine whether the specified address has a pending 7702-auth
|
||||
|
||||
store billy.Database // Persistent data store for the tx metadata and blobs
|
||||
stored uint64 // Useful data size of all transactions on disk
|
||||
limbo *limbo // Persistent data store for the non-finalized blobs
|
||||
store billy.Database // Persistent data store for the tx metadata and blobs
|
||||
slotter billy.SlotSizeFn // Slotter function to determine the shelf sizes for the billy database
|
||||
stored uint64 // Useful data size of all transactions on disk
|
||||
limbo *limbo // Persistent data store for the non-finalized blobs
|
||||
|
||||
gapped map[common.Address][]*types.Transaction // Transactions that are currently gapped (nonce too high)
|
||||
gappedSource map[common.Hash]common.Address // Source of gapped transactions to allow rechecking on inclusion
|
||||
|
|
@ -435,10 +436,10 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserver txpool.Reser
|
|||
p.state = state
|
||||
|
||||
// Create new slotter for pre-Osaka blob configuration.
|
||||
slotter := newSlotter(params.BlobTxMaxBlobs)
|
||||
p.slotter = newSlotter(params.BlobTxMaxBlobs)
|
||||
|
||||
// See if we need to migrate the queue blob store after fusaka
|
||||
slotter, err = tryMigrate(p.chain.Config(), slotter, queuedir)
|
||||
p.slotter, err = tryMigrate(p.chain.Config(), p.slotter, queuedir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -449,7 +450,7 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserver txpool.Reser
|
|||
fails = append(fails, id)
|
||||
}
|
||||
}
|
||||
store, err := billy.Open(billy.Options{Path: queuedir, Repair: true}, slotter, index)
|
||||
store, err := billy.Open(billy.Options{Path: queuedir, Repair: true}, p.slotter, index)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,25 @@
|
|||
package blobpool
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/holiman/billy"
|
||||
)
|
||||
|
||||
// getSlotSize return the storage size for a given transaction size based on the current slotter.
|
||||
func getSlotSize(slotter billy.SlotSizeFn, size uint32) (uint32, error) {
|
||||
for {
|
||||
slotSize, done := slotter()
|
||||
if size <= slotSize {
|
||||
return slotSize, nil
|
||||
}
|
||||
if done {
|
||||
return size, errors.New("size exceeds maximum slot size")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tryMigrate checks if the billy needs to be migrated and migrates if needed.
|
||||
// Returns a slotter that can be used for the database.
|
||||
func tryMigrate(config *params.ChainConfig, slotter billy.SlotSizeFn, datadir string) (billy.SlotSizeFn, error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue