@@ -880,23 +880,14 @@ impl RelayerThread {
880
880
SortitionDB :: get_canonical_stacks_chain_tip_hash ( self . sortdb . conn ( ) ) . unwrap ( ) ;
881
881
let canonical_stacks_tip =
882
882
StacksBlockId :: new ( & canonical_stacks_tip_ch, & canonical_stacks_tip_bh) ;
883
- let block_election_snapshot =
884
- SortitionDB :: get_block_snapshot_consensus ( self . sortdb . conn ( ) , & canonical_stacks_tip_ch)
885
- . map_err ( |e| {
886
- error ! ( "Relayer: failed to get block snapshot for canonical tip: {e:?}" ) ;
887
- NakamotoNodeError :: SnapshotNotFoundForChainTip
888
- } ) ?
889
- . ok_or_else ( || {
890
- error ! ( "Relayer: failed to get block snapshot for canonical tip" ) ;
891
- NakamotoNodeError :: SnapshotNotFoundForChainTip
892
- } ) ?;
893
883
894
884
let Some ( ref mining_key) = self . config . miner . mining_key else {
895
885
return Ok ( ( ) ) ;
896
886
} ;
897
887
let mining_pkh = Hash160 :: from_node_public_key ( & StacksPublicKey :: from_private ( mining_key) ) ;
898
888
899
- let last_winner_snapshot = {
889
+ // If we won the last sortition, then we should start a new tenure off of it.
890
+ let block_election_snapshot = {
900
891
let ih = self . sortdb . index_handle ( & burn_tip. sortition_id ) ;
901
892
ih. get_last_snapshot_with_sortition ( burn_tip. block_height )
902
893
. map_err ( |e| {
@@ -905,15 +896,14 @@ impl RelayerThread {
905
896
} ) ?
906
897
} ;
907
898
908
- let won_last_sortition = last_winner_snapshot . miner_pk_hash == Some ( mining_pkh) ;
899
+ let won_last_sortition = block_election_snapshot . miner_pk_hash == Some ( mining_pkh) ;
909
900
debug ! (
910
901
"Relayer: Current burn block had no sortition. Checking for tenure continuation." ;
911
902
"won_last_sortition" => won_last_sortition,
912
903
"current_mining_pkh" => %mining_pkh,
913
- "last_winner_snapshot .miner_pk_hash" => ?last_winner_snapshot . miner_pk_hash,
904
+ "block_election_snapshot .miner_pk_hash" => ?block_election_snapshot . miner_pk_hash,
914
905
"canonical_stacks_tip_id" => %canonical_stacks_tip,
915
906
"canonical_stacks_tip_ch" => %canonical_stacks_tip_ch,
916
- "block_election_ch" => %block_election_snapshot. consensus_hash,
917
907
"burn_view_ch" => %new_burn_view,
918
908
) ;
919
909
0 commit comments