From 6f6778d504be1a86796406094cd994fc3eefd314 Mon Sep 17 00:00:00 2001 From: Iulian Pascalau Date: Fri, 5 Jan 2024 18:58:45 +0200 Subject: [PATCH] - cancel start subround in single key redundancy mode --- consensus/spos/bls/subroundStartRound.go | 4 ++++ consensus/spos/bls/subroundStartRound_test.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/consensus/spos/bls/subroundStartRound.go b/consensus/spos/bls/subroundStartRound.go index 8e330f791bb..1bcdb1d3e20 100644 --- a/consensus/spos/bls/subroundStartRound.go +++ b/consensus/spos/bls/subroundStartRound.go @@ -155,6 +155,10 @@ func (sr *subroundStartRound) initCurrentRound() bool { sr.ConsensusGroup(), sr.RoundHandler().Index(), ) + // TODO refactor the usage of the single key & multikey redundancy system + if sr.NodeRedundancyHandler().IsMainMachineActive() { + return false + } } leader, err := sr.GetLeader() diff --git a/consensus/spos/bls/subroundStartRound_test.go b/consensus/spos/bls/subroundStartRound_test.go index 583861032d1..960bae5bf3f 100644 --- a/consensus/spos/bls/subroundStartRound_test.go +++ b/consensus/spos/bls/subroundStartRound_test.go @@ -428,7 +428,7 @@ func TestSubroundStartRound_InitCurrentRoundShouldReturnFalseWhenGenerateNextCon assert.False(t, r) } -func TestSubroundStartRound_InitCurrentRoundShouldReturnTrueWhenMainMachineIsActive(t *testing.T) { +func TestSubroundStartRound_InitCurrentRoundShouldReturnFalseWhenMainMachineIsActive(t *testing.T) { t.Parallel() nodeRedundancyMock := &mock.NodeRedundancyHandlerStub{ @@ -442,7 +442,7 @@ func TestSubroundStartRound_InitCurrentRoundShouldReturnTrueWhenMainMachineIsAct srStartRound := *initSubroundStartRoundWithContainer(container) r := srStartRound.InitCurrentRound() - assert.True(t, r) + assert.False(t, r) } func TestSubroundStartRound_InitCurrentRoundShouldReturnFalseWhenGetLeaderErr(t *testing.T) {