From 55cc6a797a327627b04a9feeb1a90fc3ec24e73c Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Tue, 9 Jul 2024 17:28:05 +0200 Subject: [PATCH] consensus: track down followup issues --- node/src/chain/fsm.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/node/src/chain/fsm.rs b/node/src/chain/fsm.rs index 64689e539e..d2625e61d7 100644 --- a/node/src/chain/fsm.rs +++ b/node/src/chain/fsm.rs @@ -213,8 +213,11 @@ impl SimpleFSM { } // FIXME: The block should return only if accepted. The current issue is - // that the impl of State::on_block_event don't return always the + // that the impl of State::on_block_event doesn't return always the // accepted block, so we can't rely on them + // + // Due to this issue, we reset the outer timeout even if we are not + // accepting the received block Ok(blk) } @@ -248,6 +251,13 @@ impl SimpleFSM { quorum: &payload::Quorum, msg: &Message, ) -> anyhow::Result> { + // FIXME: We should return the whole outcome for this quorum + // Basically we need to inform the upper layer if the received quorum is + // valid (even if it's a FailedQuorum) + // This will be usefull in order to: + // - Reset the idle timer if the current iteration reached a quorum + // - Move to next iteration if the quorum is a Failed one + // - Remove the FIXME in fsm::on_block_event let res = match quorum.att.result { RatificationResult::Success(Vote::Valid(hash)) => { let local_header = self.acc.read().await.tip_header().await; @@ -431,6 +441,9 @@ impl InSyncImpl { /// performed when exiting the state async fn on_exiting(&mut self) {} + /// Return Some if there is the need to switch to OutOfSync mode. + /// This way the sync-up procedure to download all missing blocks from the + /// main chain will be triggered async fn on_block_event( &mut self, remote_blk: &Block, @@ -763,6 +776,7 @@ impl self.pool.clear(); } + /// Return true if a transit back to InSync mode is needed pub async fn on_block_event( &mut self, blk: &Block,