Skip to content

Commit 5202e88

Browse files
committed
fix: check current_height vs supplied tenure_height
1 parent d0418f1 commit 5202e88

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clarity/src/vm/database/clarity_db.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,15 @@ impl<'a> ClarityDatabase<'a> {
936936
return Ok(None);
937937
}
938938
let current_height = self.get_current_block_height();
939+
if current_height <= tenure_height {
940+
return Ok(None);
941+
}
939942
// check if we're querying a 2.x block
940943
let id_bhh = self.get_index_block_header_hash(tenure_height)?;
941944
let epoch = self.get_stacks_epoch_for_block(&id_bhh)?;
942945
if !epoch.uses_nakamoto_blocks() {
943946
return Ok(Some(tenure_height));
944947
}
945-
946948
// query from the parent
947949
let query_tip = self.get_index_block_header_hash(current_height.saturating_sub(1))?;
948950
Ok(self

clarity/src/vm/tests/contracts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn test_get_block_info_eval(
139139
.unwrap();
140140

141141
let mut env = owned_env.get_exec_environment(None, None, &mut placeholder_context);
142-
142+
eprintln!("{}", contracts[i]);
143143
let eval_result = env.eval_read_only(&contract_identifier, "(test-func)");
144144
match expected[i] {
145145
// any (some UINT) is okay for checking get-block-info? time

0 commit comments

Comments
 (0)