Skip to content

Commit 24e71d0

Browse files
committed
fix: signer_coordinator highest block check logic
if the highest block in their tenure is the block the coordinator is waiting on signatures for, just return Ok
1 parent 84df8fb commit 24e71d0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use stacks::chainstate::burn::db::sortdb::SortitionDB;
2828
use stacks::chainstate::burn::{BlockSnapshot, ConsensusHash};
2929
use stacks::chainstate::nakamoto::{NakamotoBlock, NakamotoChainState};
3030
use stacks::chainstate::stacks::boot::{RewardSet, MINERS_NAME};
31-
use stacks::chainstate::stacks::db::StacksChainState;
31+
use stacks::chainstate::stacks::db::{StacksBlockHeaderTypes, StacksChainState};
3232
use stacks::chainstate::stacks::Error as ChainstateError;
3333
use stacks::codec::StacksMessageCodec;
3434
use stacks::libstackerdb::StackerDBChunkData;
@@ -425,7 +425,17 @@ impl SignerCoordinator {
425425
&parent_tenure_header.consensus_hash,
426426
)?
427427
.ok_or(NakamotoNodeError::UnexpectedChainState)?;
428-
if highest_in_tenure.index_block_hash() != parent_block_id {
428+
let highest_stacks_block_id = highest_in_tenure.index_block_hash();
429+
if &highest_stacks_block_id == block_id {
430+
// the block was included in the chainstate since we last checked!
431+
let StacksBlockHeaderTypes::Nakamoto(stored_block) =
432+
highest_in_tenure.anchored_header
433+
else {
434+
error!("Nakamoto miner produced a non-nakamoto block");
435+
return Err(NakamotoNodeError::UnexpectedChainState);
436+
};
437+
return Ok(stored_block.signer_signature);
438+
} else if highest_stacks_block_id != parent_block_id {
429439
info!("SignCoordinator: Exiting due to new stacks tip");
430440
return Err(NakamotoNodeError::StacksTipChanged);
431441
}

0 commit comments

Comments
 (0)