diff options
author | Wei-Ning Huang <w@dexon.org> | 2019-02-25 19:35:06 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:22 +0800 |
commit | bfac6dd5391b871d148713014f2694d31d9b6ea4 (patch) | |
tree | b80909c9f5ad6f6021b3ebacff51c73469401765 /dex/handler.go | |
parent | 2b2396b6bce0f21b515ac2d38556f6dca08b1770 (diff) | |
download | go-tangerine-bfac6dd5391b871d148713014f2694d31d9b6ea4.tar.gz go-tangerine-bfac6dd5391b871d148713014f2694d31d9b6ea4.tar.zst go-tangerine-bfac6dd5391b871d148713014f2694d31d9b6ea4.zip |
core: vm: flatten governance
Diffstat (limited to 'dex/handler.go')
-rw-r--r-- | dex/handler.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/dex/handler.go b/dex/handler.go index 4ffa01244..5bd615c86 100644 --- a/dex/handler.go +++ b/dex/handler.go @@ -45,6 +45,7 @@ import ( "time" coreCommon "github.com/dexon-foundation/dexon-consensus/common" + dexCore "github.com/dexon-foundation/dexon-consensus/core" coreCrypto "github.com/dexon-foundation/dexon-consensus/core/crypto" coreTypes "github.com/dexon-foundation/dexon-consensus/core/types" dkgTypes "github.com/dexon-foundation/dexon-consensus/core/types/dkg" @@ -1199,13 +1200,18 @@ func (pm *ProtocolManager) recordBroadcastLoop() { // a loop keep building and maintaining peers in notary set. // TODO: finish this func (pm *ProtocolManager) peerSetLoop() { - log.Debug("start peer set loop") - round := pm.gov.LenCRS() - 1 - log.Trace("first len crs", "len", round+1, "round", round) - if round >= 1 { - pm.peers.BuildConnection(round - 1) + log.Debug("ProtocolManager: started peer set loop") + + round := pm.gov.Round() + log.Trace("ProtocolManager: startup round", "round", round) + + if round < dexCore.DKGDelayRound { + for i := round; i <= dexCore.DKGDelayRound; i++ { + pm.peers.BuildConnection(i) + } + } else { + pm.peers.BuildConnection(round) } - pm.peers.BuildConnection(round) for { select { @@ -1216,11 +1222,16 @@ func (pm *ProtocolManager) peerSetLoop() { break } - newRound := pm.gov.LenCRS() - 1 - log.Trace("new round", "round", newRound) + newRound := pm.gov.CRSRound() + if newRound == 0 { + break + } + + log.Debug("ProtocolManager: new round", "round", newRound) if newRound == round { break } + if newRound == round+1 { pm.peers.BuildConnection(newRound) if round >= 1 { |