diff options
author | Mission Liao <mission.liao@dexon.org> | 2019-03-29 17:36:36 +0800 |
---|---|---|
committer | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-29 17:36:36 +0800 |
commit | 89f72595b39087dc6ba61a8ae3e9e80d3ba0535a (patch) | |
tree | 246f70c941e9700f4383e3cd1446cdbbf73e56c5 /core | |
parent | a69376bd9d144c462ae2b577c8147e96e4a60553 (diff) | |
download | dexon-consensus-89f72595b39087dc6ba61a8ae3e9e80d3ba0535a.tar dexon-consensus-89f72595b39087dc6ba61a8ae3e9e80d3ba0535a.tar.gz dexon-consensus-89f72595b39087dc6ba61a8ae3e9e80d3ba0535a.tar.bz2 dexon-consensus-89f72595b39087dc6ba61a8ae3e9e80d3ba0535a.tar.lz dexon-consensus-89f72595b39087dc6ba61a8ae3e9e80d3ba0535a.tar.xz dexon-consensus-89f72595b39087dc6ba61a8ae3e9e80d3ba0535a.tar.zst dexon-consensus-89f72595b39087dc6ba61a8ae3e9e80d3ba0535a.zip |
core: Fix invalid block height when triggering init round event (#533)
Diffstat (limited to 'core')
-rw-r--r-- | core/agreement-mgr.go | 9 | ||||
-rw-r--r-- | core/consensus.go | 13 |
2 files changed, 2 insertions, 20 deletions
diff --git a/core/agreement-mgr.go b/core/agreement-mgr.go index 7006242..423174c 100644 --- a/core/agreement-mgr.go +++ b/core/agreement-mgr.go @@ -116,8 +116,7 @@ type agreementMgr struct { lock sync.RWMutex } -func newAgreementMgr(con *Consensus, - initConfig agreementMgrConfig) (mgr *agreementMgr, err error) { +func newAgreementMgr(con *Consensus) (mgr *agreementMgr, err error) { mgr = &agreementMgr{ con: con, ID: con.ID, @@ -130,7 +129,6 @@ func newAgreementMgr(con *Consensus, bcModule: con.bcModule, ctx: con.ctx, processedBAResult: make(map[types.Position]struct{}, maxResultCache), - configs: []agreementMgrConfig{initConfig}, voteFilter: utils.NewVoteFilter(), } mgr.recv = &consensusBAReceiver{ @@ -199,11 +197,6 @@ func (mgr *agreementMgr) notifyRoundEvents(evts []utils.RoundEventParam) error { if len(mgr.configs) > 0 { lastCfg := mgr.configs[len(mgr.configs)-1] if e.BeginHeight != lastCfg.RoundEndHeight() { - // the init config of BA part is provided when constructing. - if len(mgr.configs) == 1 && - e.BeginHeight == lastCfg.LastPeriodBeginHeight() { - return nil - } return ErrInvalidBlockHeight } if lastCfg.RoundID() == e.Round { diff --git a/core/consensus.go b/core/consensus.go index 6e30723..05d0b93 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -684,8 +684,6 @@ func newConsensusForRound( initRound = initBlock.Position.Round initBlockHeight = initBlock.Position.Height } - initConfig := utils.GetConfigWithPanic(gov, initRound, logger) - initCRS := utils.GetCRSWithPanic(gov, initRound, logger) // Init configuration chain. ID := types.NewNodeID(prv.PublicKey()) recv := &consensusDKGReceiver{ @@ -734,16 +732,7 @@ func newConsensusForRound( if err != nil { panic(err) } - baConfig := agreementMgrConfig{} - baConfig.from(initRound, initConfig, initCRS) - // TODO(jimmy): remove -1 after we match the height with fullnode. - roundHeight := gov.GetRoundHeight(initRound) - if initRound > 0 { - roundHeight-- - } - baConfig.SetRoundBeginHeight(roundHeight) - con.baMgr, err = newAgreementMgr(con, baConfig) - if err != nil { + if con.baMgr, err = newAgreementMgr(con); err != nil { panic(err) } if err = con.prepare(initBlock); err != nil { |