Skip to content

Commit

Permalink
chore: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jcnelson committed May 6, 2024
1 parent c52e9bf commit a04c1fa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions stackslib/src/burnchains/tests/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,15 @@ fn test_store_and_fetch() {
}
assert_eq!(&header, &non_canonical_block.header());

// when we get a block header by its height, it's canonical
for (height, header) in headers.iter().enumerate() {
let hdr = BurnchainDB::get_burnchain_header(burnchain_db.conn(), &headers, height as u64)
.unwrap()
.unwrap();
assert!(headers.iter().find(|h| **h == hdr).is_some());
assert_ne!(hdr, non_canonical_block.header());
}

let looked_up_canon = burnchain_db.get_canonical_chain_tip().unwrap();
assert_eq!(&looked_up_canon, &canonical_block.header());

Expand Down

0 comments on commit a04c1fa

Please sign in to comment.