@@ -580,9 +580,16 @@ impl LocalStateMachine {
580
580
}
581
581
} ;
582
582
583
- let peer_info = client. get_peer_info ( ) ?;
584
- let next_burn_block_height = peer_info. burn_block_height ;
585
- let next_burn_block_hash = peer_info. pox_consensus ;
583
+ let ( next_burn_block_height, next_burn_block_hash) = match expected_burn_block. clone ( ) {
584
+ Some ( expected_burn_block) => (
585
+ expected_burn_block. burn_block_height ,
586
+ expected_burn_block. consensus_hash ,
587
+ ) ,
588
+ None => {
589
+ let peer_info = client. get_peer_info ( ) ?;
590
+ ( peer_info. burn_block_height , peer_info. pox_consensus )
591
+ }
592
+ } ;
586
593
let mut tx_replay_set = prior_state_machine. tx_replay_set . clone ( ) ;
587
594
588
595
if let Some ( expected_burn_block) = expected_burn_block {
@@ -997,41 +1004,8 @@ impl LocalStateMachine {
997
1004
replay_state : & ReplayState ,
998
1005
) -> Result < Option < ReplayState > , SignerChainstateError > {
999
1006
if expected_burn_block. burn_block_height > prior_state_machine. burn_block_height {
1000
- // prevent too large of a loop
1001
- if expected_burn_block
1002
- . burn_block_height
1003
- . saturating_sub ( prior_state_machine. burn_block_height )
1004
- > 10
1005
- {
1006
- return Ok ( None ) ;
1007
- }
1008
- // are we building on top of this prior tip?
1009
- let mut parent_burn_block_info =
1010
- db. get_burn_block_by_ch ( & expected_burn_block. consensus_hash ) ?;
1011
-
1012
- while parent_burn_block_info. block_height > prior_state_machine. burn_block_height {
1013
- let Ok ( parent_info) =
1014
- db. get_burn_block_by_hash ( & parent_burn_block_info. parent_burn_block_hash )
1015
- else {
1016
- warn ! (
1017
- "Failed to get parent burn block info for {}" ,
1018
- parent_burn_block_info. parent_burn_block_hash
1019
- ) ;
1020
- return Ok ( None ) ;
1021
- } ;
1022
- parent_burn_block_info = parent_info;
1023
- }
1024
- if parent_burn_block_info. consensus_hash == prior_state_machine. burn_block {
1025
- // no bitcoin fork, because we're building on the parent
1026
- return Ok ( None ) ;
1027
- } else {
1028
- info ! ( "Detected bitcoin fork - prior tip is not parent of new tip." ;
1029
- "new_tip.burn_block_height" => expected_burn_block. burn_block_height,
1030
- "new_tip.consensus_hash" => %expected_burn_block. consensus_hash,
1031
- "prior_tip.burn_block_height" => prior_state_machine. burn_block_height,
1032
- "prior_tip.consensus_hash" => %prior_state_machine. burn_block,
1033
- ) ;
1034
- }
1007
+ // no bitcoin fork, because we're higher than the previous tip
1008
+ return Ok ( None ) ;
1035
1009
}
1036
1010
if expected_burn_block. consensus_hash == prior_state_machine. burn_block {
1037
1011
// no bitcoin fork, because we're at the same burn block hash as before
0 commit comments