@@ -1169,6 +1169,55 @@ impl BlockMinerThread {
1169
1169
return vec ! [ ] ;
1170
1170
}
1171
1171
1172
+ let sortdb_tip_handle = burn_db. index_handle_at_tip ( ) ;
1173
+
1174
+ let stacks_tips: Vec < _ > = stacks_tips
1175
+ . into_iter ( )
1176
+ . filter ( |candidate| {
1177
+ let candidate_ch = & candidate. consensus_hash ;
1178
+ let candidate_burn_ht = match SortitionDB :: get_block_snapshot_consensus (
1179
+ sortdb_tip_handle. conn ( ) ,
1180
+ candidate_ch
1181
+ ) {
1182
+ Ok ( Some ( x) ) => x. block_height ,
1183
+ Ok ( None ) => {
1184
+ warn ! ( "Tried to evaluate potential chain tip with an unknown consensus hash" ;
1185
+ "consensus_hash" => %candidate_ch,
1186
+ "stacks_block_hash" => %candidate. anchored_block_hash) ;
1187
+ return false ;
1188
+ } ,
1189
+ Err ( e) => {
1190
+ warn ! ( "Error while trying to evaluate potential chain tip with an unknown consensus hash" ;
1191
+ "consensus_hash" => %candidate_ch,
1192
+ "stacks_block_hash" => %candidate. anchored_block_hash,
1193
+ "err" => ?e) ;
1194
+ return false ;
1195
+ } ,
1196
+ } ;
1197
+ let tip_ch = match sortdb_tip_handle. get_consensus_at ( candidate_burn_ht) {
1198
+ Ok ( Some ( x) ) => x,
1199
+ Ok ( None ) => {
1200
+ warn ! ( "Tried to evaluate potential chain tip with a consensus hash ahead of canonical tip" ;
1201
+ "consensus_hash" => %candidate_ch,
1202
+ "stacks_block_hash" => %candidate. anchored_block_hash) ;
1203
+ return false ;
1204
+ } ,
1205
+ Err ( e) => {
1206
+ warn ! ( "Error while trying to evaluate potential chain tip with an unknown consensus hash" ;
1207
+ "consensus_hash" => %candidate_ch,
1208
+ "stacks_block_hash" => %candidate. anchored_block_hash,
1209
+ "err" => ?e) ;
1210
+ return false ;
1211
+ } ,
1212
+ } ;
1213
+ if & tip_ch != candidate_ch {
1214
+ false
1215
+ } else {
1216
+ true
1217
+ }
1218
+ } )
1219
+ . collect ( ) ;
1220
+
1172
1221
let mut considered = HashSet :: new ( ) ;
1173
1222
let mut candidates = vec ! [ ] ;
1174
1223
let end_height = stacks_tips[ 0 ] . height ;
0 commit comments