Skip to content

Commit d778b2f

Browse files
committed
improved integration test for get_v3_block_by_height
1 parent 67dc987 commit d778b2f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9407,8 +9407,16 @@ fn v3_blockbyheight_api_endpoint() {
94079407

94089408
let block_height = tip.stacks_block_height;
94099409
let block_data = get_v3_block_by_height(block_height);
9410+
94109411
assert!(block_data.status().is_success());
9411-
assert!(block_data.bytes().unwrap().len() > 0);
9412+
let block_bytes_vec = block_data.bytes().unwrap().to_vec();
9413+
assert!(block_bytes_vec.len() > 0);
9414+
9415+
// does the block id of the returned blob matches ?
9416+
let block_id = NakamotoBlockHeader::consensus_deserialize(&mut block_bytes_vec.as_slice())
9417+
.unwrap()
9418+
.block_id();
9419+
assert_eq!(block_id, tip.index_block_hash());
94129420

94139421
info!("------------------------- Test finished, clean up -------------------------");
94149422

0 commit comments

Comments
 (0)