@@ -34,7 +34,7 @@ use stacks_common::util::secp256k1::MessageSignature;
3434use stacks_common:: { debug, info, warn} ;
3535
3636use crate :: chainstate:: {
37- ProposalEvalConfig , SignerChainstateError , SortitionState , SortitionsView ,
37+ ProposalEvalConfig , SignerChainstateError , SortitionMinerStatus , SortitionState , SortitionsView ,
3838} ;
3939use crate :: client:: { ClientError , CurrentAndLastSortition , StackerDB , StacksClient } ;
4040use crate :: signerdb:: SignerDb ;
@@ -579,6 +579,7 @@ impl LocalStateMachine {
579579 local_address : StacksAddress ,
580580 local_supported_signer_protocol_version : u64 ,
581581 reward_cycle : u64 ,
582+ sortition_state : & mut Option < SortitionsView > ,
582583 ) {
583584 // Before we ever access eval...we should make sure to include our own local state machine update message in the evaluation
584585 let Ok ( mut local_update) =
@@ -682,6 +683,21 @@ impl LocalStateMachine {
682683 active_signer_protocol_version,
683684 tx_replay_set,
684685 } ) ;
686+
687+ match new_miner {
688+ StateMachineUpdateMinerState :: ActiveMiner {
689+ current_miner_pkh, ..
690+ } => {
691+ if let Some ( sortition_state) = sortition_state {
692+ // if there is a mismatch between the new_miner ad the current sortition view, mark the current miner as invalid
693+ if current_miner_pkh != sortition_state. cur_sortition . miner_pkh {
694+ sortition_state. cur_sortition . miner_status =
695+ SortitionMinerStatus :: InvalidatedBeforeFirstBlock
696+ }
697+ }
698+ }
699+ StateMachineUpdateMinerState :: NoValidMiner => ( ) ,
700+ }
685701 }
686702 }
687703
0 commit comments