Skip to content

Commit d93d07d

Browse files
committed
WIP: use latest election winner to send mock miner messages
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 993d55b commit d93d07d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

testnet/stacks-node/src/neon_node.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,6 +2381,15 @@ impl BlockMinerThread {
23812381
"chain_id" => message.chain_id,
23822382
"num_mock_signatures" => message.mock_signatures.len(),
23832383
);
2384+
let (_, miners_info) =
2385+
NakamotoChainState::make_miners_stackerdb_config(&burn_db, &self.burn_block)?;
2386+
2387+
// find out which slot we're in. If we are not the latest sortition winner, we should not be sending anymore messages anyway
2388+
let idx = miners_info.get_latest_winner_index();
2389+
let sortitions = miners_info.get_sortitions();
2390+
let election_sortition = *sortitions
2391+
.get(idx as usize)
2392+
.expect("FATAL: latest winner index out of bounds");
23842393

23852394
if let Err(e) = SignCoordinator::send_miners_message(
23862395
&miner_config.mining_key.expect("BUG: no mining key"),
@@ -2391,7 +2400,7 @@ impl BlockMinerThread {
23912400
MinerSlotID::MockMinerMessage,
23922401
self.config.is_mainnet(),
23932402
&mut miners_stackerdb,
2394-
&self.burn_block.consensus_hash,
2403+
&election_sortition,
23952404
) {
23962405
warn!("Failed to send mock miner message: {:?}", &e);
23972406
}

0 commit comments

Comments
 (0)