Set BeaconChainHarness to return block

This is useful if you want to inspect the block.
This commit is contained in:
Paul Hauner 2019-03-26 09:46:26 +11:00
parent 098e63ac32
commit a145824c51
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6

View File

@ -207,13 +207,13 @@ impl BeaconChainHarness {
/// ///
/// This is the ideal scenario for the Beacon Chain, 100% honest participation from /// This is the ideal scenario for the Beacon Chain, 100% honest participation from
/// validators. /// validators.
pub fn advance_chain_with_block(&mut self) { pub fn advance_chain_with_block(&mut self) -> BeaconBlock {
self.increment_beacon_chain_slot(); self.increment_beacon_chain_slot();
// Produce a new block. // Produce a new block.
let block = self.produce_block(); let block = self.produce_block();
debug!("Submitting block for processing..."); debug!("Submitting block for processing...");
match self.beacon_chain.process_block(block) { match self.beacon_chain.process_block(block.clone()) {
Ok(BlockProcessingOutcome::ValidBlock(_)) => {} Ok(BlockProcessingOutcome::ValidBlock(_)) => {}
other => panic!("block processing failed with {:?}", other), other => panic!("block processing failed with {:?}", other),
}; };
@ -233,6 +233,8 @@ impl BeaconChainHarness {
}); });
debug!("Free attestations processed."); debug!("Free attestations processed.");
block
} }
/// Signs a message using some validators secret key with the `Fork` info from the latest state /// Signs a message using some validators secret key with the `Fork` info from the latest state