Introduce txpool.PendingFilter and migrate Pending(...) signatures from positional params to a typed struct.
- Add core/txpool.PendingFilter with MinTip/BaseFee fields for cheap call-site filtering
- Update txpool subpool interface and all call sites in eth/miner to pass the filter struct
- Keep behavior unchanged for empty filter (equivalent to previous nil,nil usage)
- Refresh legacypool tests to use the new API shape
This is a refactor-only change intended to improve API clarity and future extensibility without changing consensus or RPC semantics.
Introduce dynamic-fee pre-filtering in txpool pending retrieval to reduce
allocations and downstream processing work during mining and tx propagation.
What changed:
- Change the `Pending` API from `Pending(enforceTips bool)` to
`Pending(minTip *uint256.Int, baseFee *uint256.Int)` in txpool interfaces.
- Implement pre-filtering in `legacypool.Pending` by comparing effective tip
against the provided `minTip/baseFee` for non-local, non-special txs.
- Update call sites to the new API:
- miner work assembly (`miner/worker.go`)
- tx sync (`eth/sync.go`)
- pool transaction retrieval (`eth/api_backend.go`)
- protocol/test interfaces (`eth/protocol.go`, `eth/helper_test.go`).
Tests:
- Add targeted coverage for pending filtering semantics in
`core/txpool/legacypool/legacypool_test.go`, including:
- minTip threshold boundary behavior
- baseFee-aware effective tip filtering
- local/special transaction exemption behavior
- dynamic-fee boundary behavior when baseFee is nil.
Impact:
- Preserves existing behavior while making pending selection cheaper for
downstream consumers.
- Improves confidence in edge-case behavior through dedicated tests.
* refactor(txpool): remove wrapper type #27841
Partial backport of ethereum/go-ethereum PR #27841, limited to txpool wrapper removal.
- Migrate txpool interfaces/call sites from `*txpool.Transaction` to `*types.Transaction`
- Update eth/miner/contracts paths and related tests accordingly
- No intended behavior change
Blob sidecar validation/handling changes from upstream are not included here.
* refactor(core/txpool): migrate tx subscription to SubscribeTransactions #28243
Replace the old SubscribeNewTxsEvent-style plumbing with the new
SubscribeTransactions(ch, reorgs) interface across txpool, eth protocol
manager, API backend, miner worker, and test helpers.
Key changes:
- Extend txpool/subpool tx subscription interface with a reorgs flag
- Route eth tx announcement path to reorgs=false (new tx announcements only)
- Route API/miner subscriptions to reorgs=true
- Move subscription-scope cleanup to TxPool.Close()
- Add Gas field to LazyTransaction in legacy pending view
Note:
LegacyPool currently cannot strictly separate newly seen and resurrected txs,
so the reorgs flag is accepted for API compatibility and future blob-subpool
integration.
This PR adds some hardening in the lower levels of the protocol stack, to bail early on invalid data. Primarily, attacks that this PR protects against are on the "annoyance"-level, which would otherwise write a couple of megabytes of data into the log output, which is a bit resource intensive.
* eth: chain config (genesis + fork) ENR entry
* core/forkid, eth: protocol independent fork ID, update to CRC32 spec
* core/forkid, eth: make forkid a struct, next uint64, enr struct, RLP
* core/forkid: change forkhash rlp encoding from int to [4]byte
* eth: fixup eth entry a bit and update it every block
* eth: fix lint
* eth: fix crash in ethclient tests
* New struct in consensus/XDPoS/utils/types.go, util functions, and test. (#14)
* define vote, timeout, sync info, qc, tc, extra fields in types.go, add test in types_test.go
* add json tag in types.go, refine encoder decoder of extra fields
* refactor types.go utils.go
* re-write types, comments
* add Hash SigHash for types, and tests
* define Round type
* remove unnecessary logs
* add v2 engine functions placeholder
* typo fix on the consensus v2 function placeholders
* add countdown timer
* make initilised private to countdown
* add v2 specific config struct
* rename some config variables
* Implement BFT Message receiver (#13)
* fix or skip tests due to PR-136 changes
* add bft receiver functions
* add bft receiver functions
* rename tc to TimeoutCert
* implement more functions
* New struct in consensus/XDPoS/utils/types.go, util functions, and test. (#14)
* define vote, timeout, sync info, qc, tc, extra fields in types.go, add test in types_test.go
* add json tag in types.go, refine encoder decoder of extra fields
* refactor types.go utils.go
* re-write types, comments
* add Hash SigHash for types, and tests
* define Round type
* remove unnecessary logs
* add temp functions
* add v2 engine functions placeholder
* typo fix on the consensus v2 function placeholders
* add countdown timer
* make initilised private to countdown
* push verify function
* add test on receiving vote
* revert type change
* add async on broadcast function
* add quit initial
* fix test
Co-authored-by: Jianrong <wjrjerome@gmail.com>
Co-authored-by: wgr523 <wgr523@gmail.com>
* generate and verify timeout message
* Consensus V2 variable, timeout pool (#19)
* fill in XDPoS_v2 variables and processQC/TC
* add timeout pool, refine engine variables
* refactor type functions
* solve a small pointer bug
* create general pool and its test, refine engine
* refine pool, add xdpos v2 config cert threshold
* refine config
* vote and timeout handlers
* fix pool test
* bft miner preparation
* review comment improvement
* update
* relocate tests
* add and remove comment
* fix the syntax error
* update network layer and add handler functions (#23)
* update network layer and add handler functions
* fix test syntax error
* add ProcessQC implementation
* add ProcessQC tests
* add snapshot test
* add wait qc process
* remove testing files
* add route snapshot
* fix merge issue
* add default v2 behaviour (#24)
* add v2 ecrecover functions and refactor test
* fix all the tests
* put minimun lock variable
* debugging prepare and seal v2 blocks
* Trigger proposeBlockHandler after v2 block received and verified in fetcher
* skip snapshot apply related tests
* update test check
* rename bfter to bft handler and ignore normal behviour
* fix bugs during local 4 node run
* fix test
* fix sync info test
* fix bugs during local 4 node run
* rebase and fix bug
* remove hook validators function"
Co-authored-by: wgr523 <wgr523@gmail.com>
Co-authored-by: Jianrong <wjrjerome@gmail.com>
* fix or skip tests due to PR-136 changes
* add bft receiver functions
* add bft receiver functions
* rename tc to TimeoutCert
* implement more functions
* New struct in consensus/XDPoS/utils/types.go, util functions, and test. (#14)
* define vote, timeout, sync info, qc, tc, extra fields in types.go, add test in types_test.go
* add json tag in types.go, refine encoder decoder of extra fields
* refactor types.go utils.go
* re-write types, comments
* add Hash SigHash for types, and tests
* define Round type
* remove unnecessary logs
* add temp functions
* add v2 engine functions placeholder
* typo fix on the consensus v2 function placeholders
* add countdown timer
* make initilised private to countdown
* push verify function
* add test on receiving vote
* revert type change
* add async on broadcast function
* add quit initial
* fix test
Co-authored-by: Jianrong <wjrjerome@gmail.com>
Co-authored-by: wgr523 <wgr523@gmail.com>
* p2p/discover, p2p/discv5: add marshaling methods to Node
* p2p/netutil: make Netlist decodable from TOML
* common/math: encode nil HexOrDecimal256 as 0x0
* cmd/geth: add --config file flag
* cmd/geth: add missing license header
* eth: prettify Config again, fix tests
* eth: use gasprice.Config instead of duplicating its fields
* eth/gasprice: hide nil default from dumpconfig output
* cmd/geth: hide genesis block in dumpconfig output
* node: make tests compile
* console: fix tests
* cmd/geth: make TOML keys look exactly like Go struct fields
* p2p: use discovery by default
This makes the zero Config slightly more useful. It also fixes package
node tests because Node detects reuse of the datadir through the
NodeDatabase.
* cmd/geth: make ethstats URL settable through config file
* cmd/faucet: fix configuration
* cmd/geth: dedup attach tests
* eth: add comment for DefaultConfig
* eth: pass downloader.SyncMode in Config
This removes the FastSync, LightSync flags in favour of a more
general SyncMode flag.
* cmd/utils: remove jitvm flags
* cmd/utils: make mutually exclusive flag error prettier
It now reads:
Fatal: flags --dev, --testnet can't be used at the same time
* p2p: fix typo
* node: add DefaultConfig, use it for geth
* mobile: add missing NoDiscovery option
* cmd/utils: drop MakeNode
This exposed a couple of places that needed to be updated to use
node.DefaultConfig.
* node: fix typo
* eth: make fast sync the default mode
* cmd/utils: remove IPCApiFlag (unused)
* node: remove default IPC path
Set it in the frontends instead.
* cmd/geth: add --syncmode
* cmd/utils: make --ipcdisable and --ipcpath mutually exclusive
* cmd/utils: don't enable WS, HTTP when setting addr
* cmd/utils: fix --identity
The transaction pool keeps track of the current nonce in its local pendingState. When a
new block comes in the pendingState is reset. During the reset it fetches multiple times
the current state through the use of the currentState callback. When a second block comes
in during the reset its possible that the state changes during the reset. If that block
holds transactions that are currently in the pool the local pendingState that is used to
determine nonces can get out of sync.