Skip to content

Commit

Permalink
Pass empty trees to tests; use empty trees by default in Chain
Browse files Browse the repository at this point in the history
  • Loading branch information
conradoplg committed Jul 20, 2021
1 parent e013c3b commit e17e547
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions zebra-state/src/service/non_finalized_state/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,3 +758,14 @@ impl PartialEq for Chain {
}

impl Eq for Chain {}

impl Default for Chain {
fn default() -> Self {
Self::new(
// TODO: decide if we want to default to None or empty tree
Some(Default::default()),
Some(Default::default()),
Some(Default::default()),
)
}
}
2 changes: 1 addition & 1 deletion zebra-state/src/service/non_finalized_state/tests/prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn forked_equals_pushed() -> Result<()> {
}

// TODO: pass correct trees
let forked = full_chain.fork(fork_tip_hash, None, None, None).expect("fork works").expect("hash is present");
let forked = full_chain.fork(fork_tip_hash, Some(Default::default()), Some(Default::default()), Some(Default::default())).expect("fork works").expect("hash is present");

// the first check is redundant, but it's useful for debugging
prop_assert_eq!(forked.blocks.len(), partial_chain.blocks.len());
Expand Down

0 comments on commit e17e547

Please sign in to comment.