Add chain_dump fn to beacon_chain

This commit is contained in:
Paul Hauner
2019-01-26 07:20:58 +11:00
parent 4d3889d838
commit dbd5e850fe
4 changed files with 81 additions and 0 deletions

View File

@@ -12,4 +12,7 @@ fn it_can_produce_blocks() {
for _ in 0..blocks {
rig.produce_next_slot();
}
let dump = rig.chain_dump().expect("Chain dump failed.");
assert_eq!(dump.len(), blocks + 1); // + 1 for genesis block.
}

View File

@@ -1,4 +1,5 @@
use super::TestValidator;
pub use beacon_chain::dump::{Error as DumpError, SlotDump};
use beacon_chain::BeaconChain;
#[cfg(test)]
use db::{
@@ -82,4 +83,8 @@ impl TestRig {
self.validators[proposer].set_slot(slot);
self.validators[proposer].produce_block().unwrap();
}
pub fn chain_dump(&self) -> Result<Vec<SlotDump>, DumpError> {
self.beacon_chain.chain_dump()
}
}