Skip to content

Commit 7c7b7f6

Browse files
core/txpool: remove locals-tracking from txpools (#30559)
Replaces #29297, descendant from #27535 --------- This PR removes `locals` as a concept from transaction pools. Therefore, the pool now acts as very a good simulation/approximation of how our peers' pools behave. What this PR does instead, is implement a locals-tracker, which basically is a little thing which, from time to time, asks the pool "did you forget this transaction?". If it did, the tracker resubmits it. If the txpool _had_ forgotten it, chances are that the peers had also forgotten it. It will be propagated again. Doing this change means that we can simplify the pool internals, quite a lot. ### The semantics of `local` Historically, there has been two features, or usecases, that has been combined into the concept of `locals`. 1. "I want my local node to remember this transaction indefinitely, and resubmit to the network occasionally" 2. "I want this (valid) transaction included to be top-prio for my miner" This PR splits these features up, let's call it `1: local` and `2: prio`. The `prio` is not actually individual transaction, but rather a set of `address`es to prioritize. The attribute `local` means it will be tracked, and `prio` means it will be prioritized by miner. For `local`: anything transaction received via the RPC is marked as `local`, and tracked by the tracker. For `prio`: any transactions from this sender is included first, when building a block. The existing commandline-flag `--txpool.locals` sets the set of `prio` addresses. --------- Co-authored-by: Gary Rong <[email protected]>
1 parent e332431 commit 7c7b7f6

18 files changed

+493
-927
lines changed

core/txpool/blobpool/blobpool.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash) ([]*kzg4844.Blob, []*kzg4844.
12691269

12701270
// Add inserts a set of blob transactions into the pool if they pass validation (both
12711271
// consensus validity and pool restrictions).
1272-
func (p *BlobPool) Add(txs []*types.Transaction, local bool, sync bool) []error {
1272+
func (p *BlobPool) Add(txs []*types.Transaction, sync bool) []error {
12731273
var (
12741274
adds = make([]*types.Transaction, 0, len(txs))
12751275
errs = make([]error, len(txs))
@@ -1701,13 +1701,6 @@ func (p *BlobPool) ContentFrom(addr common.Address) ([]*types.Transaction, []*ty
17011701
return []*types.Transaction{}, []*types.Transaction{}
17021702
}
17031703

1704-
// Locals retrieves the accounts currently considered local by the pool.
1705-
//
1706-
// There is no notion of local accounts in the blob pool.
1707-
func (p *BlobPool) Locals() []common.Address {
1708-
return []common.Address{}
1709-
}
1710-
17111704
// Status returns the known status (unknown/pending/queued) of a transaction
17121705
// identified by their hashes.
17131706
func (p *BlobPool) Status(hash common.Hash) txpool.TxStatus {

core/txpool/legacypool/legacypool.go

Lines changed: 72 additions & 313 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)