diff options
Diffstat (limited to 'vendor/github.com')
5 files changed, 10 insertions, 27 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go index d12d30a6a..3d46c5c8b 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go @@ -315,11 +315,7 @@ func NewConsensus( logger common.Logger) *Consensus { // TODO(w): load latest blockHeight from DB, and use config at that height. - var ( - round uint64 - // round 0 and 1 are decided at beginning. - roundToNotify = round + 2 - ) + var round uint64 logger.Debug("Calling Governance.Configuration", "round", round) config := gov.Configuration(round) nodeSetCache := NewNodeSetCache(gov) @@ -366,7 +362,6 @@ func NewConsensus( authModule: authModule, event: common.NewEvent(), logger: logger, - roundToNotify: roundToNotify, } validLeader := func(block *types.Block) (bool, error) { @@ -416,9 +411,9 @@ func NewConsensus( // Run starts running DEXON Consensus. func (con *Consensus) Run(initBlock *types.Block) { - con.logger.Debug("Calling Governance.NotifyRoundHeight for genesis rounds", - "block", initBlock) - notifyGenesisRounds(initBlock, con.gov) + // The block past from full node should be delivered already or known by + // full node. We don't have to notify it. + con.roundToNotify = initBlock.Position.Round + 1 initRound := initBlock.Position.Round con.logger.Debug("Calling Governance.Configuration", "round", initRound) initConfig := con.gov.Configuration(initRound) @@ -1004,7 +999,7 @@ func (con *Consensus) preProcessBlock(b *types.Block) (err error) { func (con *Consensus) deliverBlock(b *types.Block) { con.logger.Debug("Calling Application.BlockDelivered", "block", b) con.app.BlockDelivered(b.Hash, b.Position, b.Finalization.Clone()) - if b.Position.Round+roundShift == con.roundToNotify { + if b.Position.Round == con.roundToNotify { // Only the first block delivered of that round would // trigger this noitification. con.logger.Debug("Calling Governance.NotifyRoundHeight", diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/constant.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/constant.go index 9a61c0abb..563a321f5 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/constant.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/constant.go @@ -17,9 +17,9 @@ package core -// round shift refers to the difference between block's round and config round -// derived from its state. +// ConfigRoundShift refers to the difference between block's round and config +// round derived from its state. // // For example, when round shift is 2, a block in round 0 should derive config // for round 2. -const roundShift uint64 = 2 +const ConfigRoundShift uint64 = 2 diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/interfaces.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/interfaces.go index 3a9c0752a..e07476d44 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/interfaces.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/interfaces.go @@ -111,8 +111,8 @@ type Governance interface { // Return the genesis node set if round == 0. NodeSet(round uint64) []crypto.PublicKey - // NotifyRoundHeight notifies governance contract to generate configuration - // for that round with the block on that consensus height. + // NotifyRoundHeight notifies governance contract the consensus height of + // the first block of the given round. NotifyRoundHeight(targetRound, consensusHeight uint64) //// DKG-related methods. diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice.go index dcb3368fd..108f2887b 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/lattice.go @@ -282,7 +282,6 @@ func (l *Lattice) PurgeBlocks(blocks []*types.Block) error { func (l *Lattice) AppendConfig(round uint64, config *types.Config) (err error) { l.lock.Lock() defer l.lock.Unlock() - l.pool.resize(config.NumChains) if err = l.data.appendConfig(round, config); err != nil { return diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go index 9159be858..6b9ce634f 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go @@ -159,14 +159,3 @@ func DiffUint64(a, b uint64) uint64 { } return b - a } - -// notifyGenesisRounds notifies governance to generate configs based on genesis -// state. -func notifyGenesisRounds(initBlock *types.Block, gov Governance) { - if initBlock.Position.Round != 0 || !initBlock.IsGenesis() { - return - } - for round := uint64(0); round < roundShift; round++ { - gov.NotifyRoundHeight(round, 0) - } -} |