Finish binding Tendermint, bar the P2P layer

This commit is contained in:
Luke Parker
2023-04-12 18:04:28 -04:00
parent 997dd611d5
commit 03a6470a5b
7 changed files with 192 additions and 37 deletions

View File

@@ -55,12 +55,8 @@ impl<T: Transaction> Blockchain<T> {
}
/// Add a block.
#[must_use]
pub fn add_block(&mut self, block: &Block<T>) -> bool {
// TODO: Handle desyncs re: provided transactions properly
if self.verify_block(block).is_err() {
return false;
}
pub fn add_block(&mut self, block: &Block<T>) -> Result<(), BlockError> {
self.verify_block(block)?;
// None of the following assertions should be reachable since we verified the block
self.tip = block.hash();
@@ -85,6 +81,6 @@ impl<T: Transaction> Blockchain<T> {
}
}
true
Ok(())
}
}