Skip to content

Commit 2c4eb5a

Browse files
committed
fix NextNonceWithHighestFeeRate to reset considered_txs for each block
1 parent 9cf1ed1 commit 2c4eb5a

File tree

1 file changed

+15
-2
lines changed
  • testnet/stacks-node/src/nakamoto_node

1 file changed

+15
-2
lines changed

testnet/stacks-node/src/nakamoto_node/miner.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ use stacks::chainstate::stacks::{
4141
TenureChangeCause, TenureChangePayload, TransactionAnchorMode, TransactionPayload,
4242
TransactionVersion,
4343
};
44+
use stacks::core::mempool::MemPoolWalkStrategy;
4445
use stacks::net::api::poststackerdbchunk::StackerDBErrorCodes;
4546
use stacks::net::p2p::NetworkHandle;
4647
use stacks::net::stackerdb::StackerDBs;
@@ -618,7 +619,13 @@ impl BlockMinerThread {
618619
"Miner did not find any transactions to mine, sleeping for {:?}",
619620
self.config.miner.empty_mempool_sleep_time
620621
);
621-
self.reset_nonce_cache = false;
622+
// For NextNonceWithHighestFeeRate strategy, keep reset_nonce_cache = true
623+
// to ensure considered_txs table is cleared for each block attempt
624+
if self.config.miner.mempool_walk_strategy
625+
!= MemPoolWalkStrategy::NextNonceWithHighestFeeRate
626+
{
627+
self.reset_nonce_cache = false;
628+
}
622629

623630
// Pause the miner to wait for transactions to arrive
624631
let now = Instant::now();
@@ -733,7 +740,13 @@ impl BlockMinerThread {
733740
);
734741

735742
// We successfully mined, so the mempool caches are valid.
736-
self.reset_nonce_cache = false;
743+
// For NextNonceWithHighestFeeRate strategy, keep reset_nonce_cache = true
744+
// to ensure considered_txs table is cleared for each block attempt
745+
if self.config.miner.mempool_walk_strategy
746+
!= MemPoolWalkStrategy::NextNonceWithHighestFeeRate
747+
{
748+
self.reset_nonce_cache = false;
749+
}
737750
}
738751

739752
// update mined-block counters and mined-tenure counters

0 commit comments

Comments
 (0)