@@ -29,6 +29,8 @@ import (
29
29
"sync"
30
30
"time"
31
31
32
+ "github.com/holiman/billy"
33
+ "github.com/holiman/uint256"
32
34
"github.com/scroll-tech/go-ethereum/common"
33
35
"github.com/scroll-tech/go-ethereum/consensus/misc/eip1559"
34
36
"github.com/scroll-tech/go-ethereum/consensus/misc/eip4844"
@@ -42,8 +44,6 @@ import (
42
44
"github.com/scroll-tech/go-ethereum/params"
43
45
"github.com/scroll-tech/go-ethereum/rlp"
44
46
"github.com/scroll-tech/go-ethereum/rollup/fees"
45
- "github.com/holiman/billy"
46
- "github.com/holiman/uint256"
47
47
)
48
48
49
49
const (
@@ -1381,6 +1381,16 @@ func (p *BlobPool) drop() {
1381
1381
// Pending retrieves all currently processable transactions, grouped by origin
1382
1382
// account and sorted by nonce.
1383
1383
func (p * BlobPool ) Pending (enforceTips bool ) map [common.Address ][]* txpool.LazyTransaction {
1384
+ return p .pendingWithMax (enforceTips , math .MaxInt )
1385
+ }
1386
+
1387
+ // PendingWithMax works similar to Pending but allows setting an upper limit on how many
1388
+ // accounts to return
1389
+ func (p * BlobPool ) PendingWithMax (enforceTips bool , maxAccountsNum int ) map [common.Address ][]* txpool.LazyTransaction {
1390
+ return p .pendingWithMax (enforceTips , maxAccountsNum )
1391
+ }
1392
+
1393
+ func (p * BlobPool ) pendingWithMax (enforceTips bool , maxAccountsNum int ) map [common.Address ][]* txpool.LazyTransaction {
1384
1394
// Track the amount of time waiting to retrieve the list of pending blob txs
1385
1395
// from the pool and the amount of time actually spent on assembling the data.
1386
1396
// The latter will be pretty much moot, but we've kept it to have symmetric
@@ -1411,6 +1421,9 @@ func (p *BlobPool) Pending(enforceTips bool) map[common.Address][]*txpool.LazyTr
1411
1421
if len (lazies ) > 0 {
1412
1422
pending [addr ] = lazies
1413
1423
}
1424
+ if len (pending ) >= maxAccountsNum {
1425
+ break
1426
+ }
1414
1427
}
1415
1428
return pending
1416
1429
}
0 commit comments