File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1616,6 +1616,15 @@ impl MemPoolDB {
1616
1616
. query ( NO_PARAMS )
1617
1617
. map_err ( Error :: SqliteError ) ?;
1618
1618
1619
+ // Here we have a nested loop to walk the mempool.
1620
+ //
1621
+ // The `GlobalFeeRate` strategy includes all transactions, so we just
1622
+ // query once and walk the full mempool in the inner loop.
1623
+ //
1624
+ // The `NextNonceWithHighestFeeRate` strategy only selects transactions
1625
+ // that have the next expected nonce, so we need to re-query the
1626
+ // mempool after one batch has been processed and the nonce table has
1627
+ // been updated. This is handled in the outer loop.
1619
1628
let stop_reason = loop {
1620
1629
let mut state_changed = false ;
1621
1630
@@ -1902,7 +1911,11 @@ impl MemPoolDB {
1902
1911
} ;
1903
1912
1904
1913
// If we've reached the end of the mempool, or if we've stopped
1905
- // iterating for some other reason, break out of the loop
1914
+ // iterating for some other reason, break out of the loop. In the
1915
+ // case of `NextNonceWithHighestFeeRate` we know we've reached the
1916
+ // end of the mempool if the state has not changed. In the case of
1917
+ // `GlobalFeeRate` we know we've reached the end of the mempool if
1918
+ // the stop reason is `NoMoreCandidates`.
1906
1919
if settings. strategy != MemPoolWalkStrategy :: NextNonceWithHighestFeeRate
1907
1920
|| stop_reason != MempoolIterationStopReason :: NoMoreCandidates
1908
1921
|| !state_changed
You can’t perform that action at this time.
0 commit comments