Skip to content

[r3.4] txpool: use poolDB tx for getCachedBlobTxnLocked#20489

Merged
AskAlexSharov merged 1 commit intorelease/3.4from
alex/txpool_db_34
Apr 11, 2026
Merged

[r3.4] txpool: use poolDB tx for getCachedBlobTxnLocked#20489
AskAlexSharov merged 1 commit intorelease/3.4from
alex/txpool_db_34

Conversation

@AskAlexSharov
Copy link
Copy Markdown
Collaborator

Summary

OnNewBlock was passing the chaindata coreTx into getCachedBlobTxnLocked, but that function reads kv.PoolTransaction — a table that lives in the txpool DB, not chaindata. MDBX therefore can't find the table and the call fails on every blob-txn unwind path, producing warnings like:

[fetch] onNewBlock err="TxPool.getCachedBlobTxnLocked: Get: 32, label: chaindata, ...

Fix: open a RO tx on poolDB and pass that into getCachedBlobTxnLocked. The tx is opened before p.lock is acquired, which preserves the existing RoTx→p.lock ordering documented in pool.go to avoid deadlocks.

OnNewBlock was passing the chaindata coreTx into getCachedBlobTxnLocked,
which reads kv.PoolTransaction — a table that lives in the txpool DB,
not chaindata. This produced warnings like:

  [fetch] onNewBlock err="TxPool.getCachedBlobTxnLocked: Get: 32, label: chaindata, ...

Open a RO tx on poolDB (before p.lock, preserving the existing lock
ordering) and pass that instead.
Copy link
Copy Markdown
Collaborator

@Giulio2002 Giulio2002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM \u2014 very small diff

@AskAlexSharov AskAlexSharov merged commit 5c755e1 into release/3.4 Apr 11, 2026
20 checks passed
@AskAlexSharov AskAlexSharov deleted the alex/txpool_db_34 branch April 11, 2026 15:13
AskAlexSharov added a commit that referenced this pull request Apr 13, 2026
`OnNewBlock` was passing the chaindata `coreTx` into
`getCachedBlobTxnLocked`, but that function reads `kv.PoolTransaction` —
a table that lives in the txpool DB, not chaindata. MDBX therefore can't
find the table and the call fails on every blob-txn unwind path,
producing warnings like:

```
[fetch] onNewBlock err="TxPool.getCachedBlobTxnLocked: Get: 32, label: chaindata, ...
```

Fix: open a RO tx on `poolDB` and pass that into
`getCachedBlobTxnLocked`. The tx is opened before `p.lock` is acquired,
which preserves the existing RoTx→p.lock ordering documented in
`pool.go` to avoid deadlocks.
AskAlexSharov added a commit that referenced this pull request Apr 14, 2026
The cherry-picked PR #20489 added p.poolDB.BeginRo() in OnNewBlock,
but several tests pass nil for poolDB since they don't exercise blob
txn paths. Guard the BeginRo call and skip blob cache lookups when
poolDB is nil.
github-merge-queue bot pushed a commit that referenced this pull request Apr 14, 2026
## Summary
Cherry-pick latest 20 PRs from release/3.4 to main (15 already applied,
5 new):

- #20399 — hive: pin more things
- #20457 — up x deps
- #20469 — attempt to drop oldPrune method
- #20489 — txpool: use poolDB tx for getCachedBlobTxnLocked
- #20517 — teach: Unwind beyond data in snapshots not allowed

---------

Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Muzry <muzrry@gmail.com>
Co-authored-by: muzry.li <muzry.li1@ambergroup.io>
Co-authored-by: info@weblogix.biz <admin@10gbps.weblogix.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants