aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/consensus.go b/core/consensus.go
index 19ba74c..4e01860 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -735,7 +735,11 @@ func newConsensusForRound(
baConfig := agreementMgrConfig{}
baConfig.from(initRound, initConfig, initCRS)
// TODO(jimmy): remove -1 after we match the height with fullnode.
- baConfig.SetRoundBeginHeight(gov.GetRoundHeight(initRound) - 1)
+ roundHeight := gov.GetRoundHeight(initRound)
+ if initRound > 0 {
+ roundHeight--
+ }
+ baConfig.SetRoundBeginHeight(roundHeight)
con.baMgr, err = newAgreementMgr(con, baConfig)
if err != nil {
panic(err)
@@ -812,7 +816,11 @@ func (con *Consensus) prepare(initBlock *types.Block) (err error) {
}
// The init config is provided to baModule when construction.
// TODO(jimmy): remove -1 after we match the height with fullnode.
- if evts[len(evts)-1].BeginHeight != con.gov.GetRoundHeight(initRound)-1 {
+ roundHeight := con.gov.GetRoundHeight(initRound)
+ if initRound > 0 {
+ roundHeight--
+ }
+ if evts[len(evts)-1].BeginHeight != roundHeight {
if err := con.baMgr.notifyRoundEvents(evts); err != nil {
panic(err)
}