mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Implement block proposal logic
This commit is contained in:
@@ -186,6 +186,9 @@ pub trait Network: Send + Sync {
|
||||
/// consider it valid and created a commit for it. This deviates from the paper which will have a
|
||||
/// local node refuse to decide on a block it considers invalid. This library acknowledges the
|
||||
/// network did decide on it, leaving handling of it to the network, and outside of this scope.
|
||||
fn add_block(&mut self, block: Self::Block, commit: Commit<Self::SignatureScheme>)
|
||||
-> Self::Block;
|
||||
async fn add_block(
|
||||
&mut self,
|
||||
block: Self::Block,
|
||||
commit: Commit<Self::SignatureScheme>,
|
||||
) -> Self::Block;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
||||
};
|
||||
debug_assert!(machine.network.read().await.verify_commit(block.id(), &commit));
|
||||
|
||||
let proposal = machine.network.write().await.add_block(block, commit);
|
||||
let proposal = machine.network.write().await.add_block(block, commit).await;
|
||||
machine.reset(proposal).await;
|
||||
}
|
||||
Err(TendermintError::Malicious(validator)) => {
|
||||
|
||||
@@ -113,7 +113,11 @@ impl Network for TestNetwork {
|
||||
block.valid
|
||||
}
|
||||
|
||||
fn add_block(&mut self, block: TestBlock, commit: Commit<TestSignatureScheme>) -> TestBlock {
|
||||
async fn add_block(
|
||||
&mut self,
|
||||
block: TestBlock,
|
||||
commit: Commit<TestSignatureScheme>,
|
||||
) -> TestBlock {
|
||||
dbg!("Adding ", &block);
|
||||
assert!(block.valid.is_ok());
|
||||
assert!(self.verify_commit(block.id(), &commit));
|
||||
|
||||
Reference in New Issue
Block a user