Skip to content

Commit

Permalink
chore: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Oct 18, 2024
1 parent e272540 commit 8588568
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions testnet/stacks-node/src/tests/nakamoto_integrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8328,7 +8328,9 @@ fn check_block_info() {
"Contract 3 should be able to fetch the StacksBlockId of the tip"
);

let blocks = test_observer::get_blocks();
let mut blocks = test_observer::get_blocks();
blocks.sort_by_key(|block| block["block_height"].as_u64().unwrap());

let mut last_tenture_height = 0;
for block in blocks.iter() {
let transactions = block.get("transactions").unwrap().as_array().unwrap();
Expand All @@ -8346,11 +8348,15 @@ fn check_block_info() {
}
}
// if `signer_bitvec` is set on a block, then it's a nakamoto block
let is_nakamoto_block = block.get("signer_bitvec").is_some();

let is_nakamoto_block = block.get("signer_bitvec").map_or(false, |v| !v.is_null());
let tenure_height = block.get("tenure_height").unwrap().as_u64().unwrap();
let block_height = block.get("block_height").unwrap().as_u64().unwrap();

if block_height == 0 {
// genesis block
continue;
}

if is_nakamoto_block {
if block_has_tenure_change {
// tenure change block should have tenure height 1 more than the last tenure height
Expand Down

0 comments on commit 8588568

Please sign in to comment.