aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhaoping-ku <haoping.ku@dexon.org>2018-12-05 14:29:54 +0800
committerGitHub <noreply@github.com>2018-12-05 14:29:54 +0800
commit56e872f84131348adbc0861afb3554bba4a8e5db (patch)
tree553e086a35dacaa4dfd1b688da2b6ddee2a6f103
parent3a6b94650d38ea979e00f15350321737418aba39 (diff)
downloaddexon-consensus-56e872f84131348adbc0861afb3554bba4a8e5db.tar
dexon-consensus-56e872f84131348adbc0861afb3554bba4a8e5db.tar.gz
dexon-consensus-56e872f84131348adbc0861afb3554bba4a8e5db.tar.bz2
dexon-consensus-56e872f84131348adbc0861afb3554bba4a8e5db.tar.lz
dexon-consensus-56e872f84131348adbc0861afb3554bba4a8e5db.tar.xz
dexon-consensus-56e872f84131348adbc0861afb3554bba4a8e5db.tar.zst
dexon-consensus-56e872f84131348adbc0861afb3554bba4a8e5db.zip
core: syncer: fix round finding process (#357)
* core: syncer: fix round finding process * Fix comment
-rw-r--r--core/syncer/consensus.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/syncer/consensus.go b/core/syncer/consensus.go
index ce6fdc3..176673b 100644
--- a/core/syncer/consensus.go
+++ b/core/syncer/consensus.go
@@ -239,10 +239,10 @@ func (con *Consensus) ensureAgreementOverlapRound() bool {
func (con *Consensus) findLatticeSyncBlock(
blocks []*types.Block) (*types.Block, error) {
- var lastBlock = blocks[len(blocks)-1]
+ lastBlock := blocks[len(blocks)-1]
+ round := lastBlock.Position.Round
for {
// Find round r which r-1, r, r+1 are all in same total ordering config.
- round := lastBlock.Position.Round
for {
sameAsPrevRound := round == 0 || !con.isConfigChanged(
con.configs[round-1], con.configs[round])
@@ -257,7 +257,7 @@ func (con *Consensus) findLatticeSyncBlock(
}
round--
}
- // Find the oldest block which round is "round".
+ // Find the newset block which round is "round".
for lastBlock.Position.Round != round {
if (lastBlock.Finalization.ParentHash == common.Hash{}) {
return nil, ErrGenesisBlockReached