@@ -5,19 +5,19 @@ import (
5
5
"time"
6
6
)
7
7
8
- func (cache * TxCache ) doSelectTransactions (accountStateProvider AccountStateProvider , gasRequested uint64 , maxNum int , selectionLoopMaximumDuration time.Duration ) (bunchOfTransactions , uint64 ) {
8
+ func (cache * TxCache ) doSelectTransactions (session SelectionSession , gasRequested uint64 , maxNum int , selectionLoopMaximumDuration time.Duration ) (bunchOfTransactions , uint64 ) {
9
9
senders := cache .getSenders ()
10
10
bunches := make ([]bunchOfTransactions , 0 , len (senders ))
11
11
12
12
for _ , sender := range senders {
13
13
bunches = append (bunches , sender .getTxs ())
14
14
}
15
15
16
- return selectTransactionsFromBunches (accountStateProvider , bunches , gasRequested , maxNum , selectionLoopMaximumDuration )
16
+ return selectTransactionsFromBunches (session , bunches , gasRequested , maxNum , selectionLoopMaximumDuration )
17
17
}
18
18
19
19
// Selection tolerates concurrent transaction additions / removals.
20
- func selectTransactionsFromBunches (accountStateProvider AccountStateProvider , bunches []bunchOfTransactions , gasRequested uint64 , maxNum int , selectionLoopMaximumDuration time.Duration ) (bunchOfTransactions , uint64 ) {
20
+ func selectTransactionsFromBunches (session SelectionSession , bunches []bunchOfTransactions , gasRequested uint64 , maxNum int , selectionLoopMaximumDuration time.Duration ) (bunchOfTransactions , uint64 ) {
21
21
selectedTransactions := make (bunchOfTransactions , 0 , initialCapacityOfSelectionSlice )
22
22
23
23
// Items popped from the heap are added to "selectedTransactions".
@@ -57,7 +57,7 @@ func selectTransactionsFromBunches(accountStateProvider AccountStateProvider, bu
57
57
}
58
58
}
59
59
60
- err := item .requestAccountStateIfNecessary (accountStateProvider )
60
+ err := item .requestAccountStateIfNecessary (session )
61
61
if err != nil {
62
62
// Skip this sender.
63
63
logSelect .Debug ("TxCache.selectTransactionsFromBunches, could not retrieve account state" , "sender" , item .sender , "err" , err )
@@ -71,7 +71,7 @@ func selectTransactionsFromBunches(accountStateProvider AccountStateProvider, bu
71
71
continue
72
72
}
73
73
74
- shouldSkipTransaction := detectSkippableTransaction (accountStateProvider , item )
74
+ shouldSkipTransaction := detectSkippableTransaction (session , item )
75
75
if shouldSkipTransaction {
76
76
// Transaction isn't selected, but the sender is still in the game (will contribute with other transactions).
77
77
} else {
@@ -104,11 +104,11 @@ func detectSkippableSender(item *transactionsHeapItem) bool {
104
104
return false
105
105
}
106
106
107
- func detectSkippableTransaction (accountStateProvider AccountStateProvider , item * transactionsHeapItem ) bool {
107
+ func detectSkippableTransaction (session SelectionSession , item * transactionsHeapItem ) bool {
108
108
if item .detectLowerNonce () {
109
109
return true
110
110
}
111
- if item .detectBadlyGuarded (accountStateProvider ) {
111
+ if item .detectBadlyGuarded (session ) {
112
112
return true
113
113
}
114
114
if item .detectNonceDuplicate () {
0 commit comments