From b8473649128039fa9c2b93ca9acac7f9661480ea Mon Sep 17 00:00:00 2001 From: turuslan Date: Fri, 1 Sep 2023 13:05:22 +0300 Subject: [PATCH] fix grandpa loop Signed-off-by: turuslan --- core/consensus/grandpa/impl/environment_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/consensus/grandpa/impl/environment_impl.cpp b/core/consensus/grandpa/impl/environment_impl.cpp index 9a845b08b5..b9279b1cbe 100644 --- a/core/consensus/grandpa/impl/environment_impl.cpp +++ b/core/consensus/grandpa/impl/environment_impl.cpp @@ -201,7 +201,7 @@ namespace kagome::consensus::grandpa { // Select best block with actual set_id if (voter_set_id.has_value()) { - while (true) { + while (best_block.number > finalized.number) { OUTCOME_TRY(header, header_repository_->getBlockHeader(best_block.hash)); BlockInfo parent_block{header.number - 1, header.parent_hash}; @@ -210,7 +210,7 @@ namespace kagome::consensus::grandpa { parent_block, IsBlockFinalized{true}); if (voter_set.has_value() - && voter_set.value()->id == voter_set_id.value()) { + and voter_set.value()->id <= voter_set_id.value()) { // found break; }