core/txpool/blobpool: fix announced state initialization and tests

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2026-02-04 10:31:31 +01:00
parent 0e980c6ea2
commit 9c4a1f9008
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E
2 changed files with 17 additions and 2 deletions

View file

@ -491,6 +491,20 @@ func (p *BlobPool) Init(gasTip uint64, head *types.Header, reserver txpool.Reser
}
p.evict = newPriceHeap(basefee, blobfee, p.index)
// Guess what was announced. This is needed because we don't want to
// participate in the diffusion of transactions where inclusion is blocked by
// a low base fee transaction. Since we don't persist that info, the best
// we can do is to assume that anything that could have been announced
// at current prices, actually was.
for addr := range p.index {
for _, tx := range p.index[addr] {
tx.announced = p.isAnnouncable(tx)
if !tx.announced {
break
}
}
}
// Pool initialized, attach the blob limbo to it to track blobs included
// recently but not yet finalized
p.limbo, err = newLimbo(p.chain.Config(), limbodir)
@ -538,6 +552,7 @@ func (p *BlobPool) Close() error {
// parseTransaction is a callback method on pool creation that gets called for
// each transaction on disk to create the in-memory metadata index.
// Announced state is not initialized here, it needs to be iniitalized seprately.
func (p *BlobPool) parseTransaction(id uint64, size uint32, blob []byte) error {
tx := new(types.Transaction)
if err := rlp.DecodeBytes(blob, tx); err != nil {

View file

@ -1751,8 +1751,8 @@ func TestAdd(t *testing.T) {
// Create a blob pool out of the pre-seeded dats
chain := &testBlockChain{
config: params.MainnetChainConfig,
basefee: uint256.NewInt(1050),
blobfee: uint256.NewInt(105),
basefee: uint256.NewInt(1),
blobfee: uint256.NewInt(1),
statedb: statedb,
}
pool := New(Config{Datadir: storage}, chain, nil)