@@ -205,7 +205,7 @@ type bundleCheckerFactory func(
205205 chain StateReader ,
206206 state state.StateDB ,
207207 signer types.Signer ,
208- ) bundleChecker
208+ ) utils. Checker
209209
210210// TxPoolConfig are the configuration parameters of the transaction pool.
211211type TxPoolConfig struct {
@@ -352,6 +352,7 @@ type TxPool struct {
352352 subsidiesCheckerCache * utils.CheckerCache // Cache for subsidies check results
353353
354354 bundleCheckerFactory bundleCheckerFactory // Factory to create a bundle checker instance
355+ bundlesCheckerCache * utils.CheckerCache // Cache for bundle check results
355356}
356357
357358type txpoolResetRequest struct {
@@ -364,7 +365,7 @@ func NewTxPool(
364365 config TxPoolConfig ,
365366 chainconfig * params.ChainConfig ,
366367 chain StateReader ) * TxPool {
367- return newTxPool (config , chainconfig , chain , createSubsidiesChecker , newBundleChecker )
368+ return newTxPool (config , chainconfig , chain , createSubsidiesChecker , createBundleChecker )
368369}
369370
370371func newTxPool (
@@ -402,7 +403,7 @@ func newTxPool(
402403 subsidiesCheckerCache : utils .NewCheckerCache (- 1 ), // use default size
403404
404405 bundleCheckerFactory : bundleCheckerFactory ,
405- // TODO: add a cache for bundle checker results if the checks are expensive
406+ bundlesCheckerCache : utils . NewCheckerCache ( - 1 ), // use default size
406407 }
407408 pool .locals = newAccountSet (pool .signer )
408409 for _ , addr := range config .Locals {
@@ -1522,13 +1523,14 @@ func (pool *TxPool) createCachedSubsidiesChecker() utils.Checker {
15221523 ))
15231524}
15241525
1525- func (pool * TxPool ) createBundleChecker () bundleChecker {
1526- return pool .bundleCheckerFactory (
1527- pool .chain .CurrentRules (),
1528- pool .chain ,
1529- pool .currentState ,
1530- pool .signer ,
1531- )
1526+ func (pool * TxPool ) createBundleChecker () utils.Checker {
1527+ return pool .bundlesCheckerCache .Wrap (
1528+ pool .bundleCheckerFactory (
1529+ pool .chain .CurrentRules (),
1530+ pool .chain ,
1531+ pool .currentState ,
1532+ pool .signer ,
1533+ ))
15321534}
15331535
15341536// promoteExecutables moves transactions that have become processable from the
0 commit comments