@@ -877,25 +877,6 @@ impl RelayerThread {
877
877
Ok ( ( ) )
878
878
}
879
879
880
- /// Get a snapshot for an existing burn chain block given its consensus hash.
881
- fn get_block_snapshot_consensus (
882
- & self ,
883
- ch : & ConsensusHash ,
884
- ) -> Result < BlockSnapshot , NakamotoNodeError > {
885
- SortitionDB :: get_block_snapshot_consensus ( self . sortdb . conn ( ) , ch)
886
- . map_err ( |e| {
887
- error ! (
888
- "Relayer: failed to get block snapshot for new burn view: {:?}" ,
889
- e
890
- ) ;
891
- NakamotoNodeError :: SnapshotNotFoundForChainTip
892
- } ) ?
893
- . ok_or_else ( || {
894
- error ! ( "Relayer: failed to get block snapshot for new burn view" ) ;
895
- NakamotoNodeError :: SnapshotNotFoundForChainTip
896
- } )
897
- }
898
-
899
880
/// Get the public key hash for the mining key.
900
881
fn get_mining_key_pkh ( & self ) -> Option < Hash160 > {
901
882
let Some ( ref mining_key) = self . config . miner . mining_key else {
@@ -922,13 +903,7 @@ impl RelayerThread {
922
903
& mut self . chainstate . index_conn ( ) ,
923
904
tip_block_id,
924
905
& ch,
925
- )
926
- . map_err ( |e| {
927
- error ! (
928
- "Relayer: Failed to get tenure-start block header for stacks tip {tip_block_id}: {e:?}"
929
- ) ;
930
- NakamotoNodeError :: ParentNotFound
931
- } ) ?
906
+ ) ?
932
907
. ok_or_else ( || {
933
908
error ! (
934
909
"Relayer: Failed to find tenure-start block header for stacks tip {tip_block_id}"
@@ -1005,18 +980,6 @@ impl RelayerThread {
1005
980
}
1006
981
}
1007
982
1008
- fn get_block_snapshot ( & self , ch : & ConsensusHash ) -> Result < BlockSnapshot , NakamotoNodeError > {
1009
- SortitionDB :: get_block_snapshot_consensus ( self . sortdb . conn ( ) , & ch)
1010
- . map_err ( |e| {
1011
- error ! ( "Relayer: failed to get block snapshot for canonical tip: {e:?}" ) ;
1012
- NakamotoNodeError :: SnapshotNotFoundForChainTip
1013
- } ) ?
1014
- . ok_or_else ( || {
1015
- error ! ( "Relayer: failed to get block snapshot for canonical tip" ) ;
1016
- NakamotoNodeError :: SnapshotNotFoundForChainTip
1017
- } )
1018
- }
1019
-
1020
983
/// Attempt to continue a miner's tenure into the next burn block.
1021
984
/// This is allowed if the miner won the last good sortition and one of the
1022
985
/// following conditions is met:
@@ -1032,7 +995,12 @@ impl RelayerThread {
1032
995
debug ! ( "Relayer: successfully stopped tenure." ) ;
1033
996
1034
997
// Get the necessary snapshots and state
1035
- let burn_tip = self . get_block_snapshot_consensus ( & new_burn_view) ?;
998
+ let burn_tip =
999
+ SortitionDB :: get_block_snapshot_consensus ( self . sortdb . conn ( ) , & new_burn_view) ?
1000
+ . ok_or_else ( || {
1001
+ error ! ( "Relayer: failed to get block snapshot for new burn view" ) ;
1002
+ NakamotoNodeError :: SnapshotNotFoundForChainTip
1003
+ } ) ?;
1036
1004
let ( canonical_stacks_tip_ch, canonical_stacks_tip_bh) =
1037
1005
SortitionDB :: get_canonical_stacks_chain_tip_hash ( self . sortdb . conn ( ) ) . unwrap ( ) ;
1038
1006
let canonical_stacks_tip =
@@ -1066,7 +1034,14 @@ impl RelayerThread {
1066
1034
return Ok ( ( ) ) ;
1067
1035
}
1068
1036
1069
- let canonical_snapshot = self . get_block_snapshot ( & canonical_stacks_tip_ch) ?;
1037
+ let canonical_snapshot = SortitionDB :: get_block_snapshot_consensus (
1038
+ self . sortdb . conn ( ) ,
1039
+ & canonical_stacks_tip_ch,
1040
+ ) ?
1041
+ . ok_or_else ( || {
1042
+ error ! ( "Relayer: failed to get block snapshot for canonical tip" ) ;
1043
+ NakamotoNodeError :: SnapshotNotFoundForChainTip
1044
+ } ) ?;
1070
1045
let ( parent_tenure_start, block_election_snapshot, reason) = self . determine_tenure_type (
1071
1046
canonical_snapshot,
1072
1047
last_good_block_election_snapshot,
0 commit comments