mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-04 23:32:55 +00:00
reset the max fixed size
This commit is contained in:
parent
9109dba92c
commit
be178a5f27
2 changed files with 18 additions and 30 deletions
|
|
@ -540,11 +540,6 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserver txpool.Reser
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If blob txs still exist in limbo, delete the old ones and reset with new ones without tx content.
|
|
||||||
if err = p.limbo.setTxMeta(p.store); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the configured gas tip, triggering a filtering of anything just loaded
|
// Set the configured gas tip, triggering a filtering of anything just loaded
|
||||||
basefeeGauge.Update(int64(basefee.Uint64()))
|
basefeeGauge.Update(int64(basefee.Uint64()))
|
||||||
blobfeeGauge.Update(int64(blobfee.Uint64()))
|
blobfeeGauge.Update(int64(blobfee.Uint64()))
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,10 @@ func newLimbo(config *params.ChainConfig, datadir string) (*limbo, error) {
|
||||||
index: make(map[common.Hash]*limboBlob),
|
index: make(map[common.Hash]*limboBlob),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new slotter for pre-Osaka blob configuration.
|
// The limbo won't store full blobs, just metadata, so use a fixed size 4KB is big enough.
|
||||||
slotter := newSlotter(params.BlobTxMaxBlobs)
|
slotter := func() (size uint32, done bool) {
|
||||||
|
return 4096, true
|
||||||
|
}
|
||||||
|
|
||||||
// See if we need to migrate the limbo after fusaka.
|
// See if we need to migrate the limbo after fusaka.
|
||||||
slotter, err := tryMigrate(config, slotter, datadir)
|
slotter, err := tryMigrate(config, slotter, datadir)
|
||||||
|
|
@ -83,6 +85,14 @@ func newLimbo(config *params.ChainConfig, datadir string) (*limbo, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Migrate any old-style limbo entries which stored full blob transactions
|
||||||
|
// instead of just the metadata.
|
||||||
|
if err = l.cleanTxStorage(); err != nil {
|
||||||
|
l.Close()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,36 +125,19 @@ func (l *limbo) parseBlob(id uint64, data []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setTxMeta attempts to repair the limbo by re-encoding all transactions that are
|
// cleanTxStorage migrates any old-style limbo entries which stored the full
|
||||||
// currently in the limbo, but not yet stored in the database. This is useful
|
// blob transaction instead of just the metadata.
|
||||||
// when the limbo is created from a previous state, and the transactions are not
|
func (l *limbo) cleanTxStorage() error {
|
||||||
// yet stored in the database. The method will re-encode all transactions and
|
|
||||||
// store them in the database, updating the in-memory indices at the same time.
|
|
||||||
func (l *limbo) setTxMeta(store billy.Database) error {
|
|
||||||
for _, item := range l.index {
|
for _, item := range l.index {
|
||||||
if item.Tx == nil {
|
if item.Tx == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tx := item.Tx
|
// Delete the old item which hash blob tx content.
|
||||||
item.Tx = nil // Clear the in-memory tx
|
if err := l.drop(item.TxMeta.hash); err != nil {
|
||||||
// Transaction permitted into the pool from a nonce and cost perspective,
|
|
||||||
// insert it into the database and update the indices
|
|
||||||
blob, err := rlp.EncodeToBytes(tx)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Failed to encode transaction for storage", "hash", tx.Hash(), "err", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
id, err := store.Put(blob)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
meta := newBlobTxMeta(id, tx.Size(), store.Size(id), tx)
|
|
||||||
// Delete the old item which has blob tx content.
|
|
||||||
if err := l.drop(meta.hash); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Set the new one which has blob tx metadata.
|
// Set the new one which has blob tx metadata.
|
||||||
if err := l.push(meta, item.Block); err != nil {
|
if err := l.push(item.TxMeta, item.Block); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue