aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/utils
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-03-28 18:24:46 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-15 22:09:55 +0800
commit41193d921118b4bdef5f0a1a5b7349a4c58abe94 (patch)
treef5a274c3d007810064e3ed65e6e52390fb93669e /vendor/github.com/dexon-foundation/dexon-consensus/core/utils
parent4efc1cf485200000420bd79638139eb5383641ae (diff)
downloadgo-tangerine-41193d921118b4bdef5f0a1a5b7349a4c58abe94.tar.gz
go-tangerine-41193d921118b4bdef5f0a1a5b7349a4c58abe94.tar.zst
go-tangerine-41193d921118b4bdef5f0a1a5b7349a4c58abe94.zip
vendor: sync to latest core
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/utils')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go
index 885c755f7..0e70cf250 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils/round-event.go
@@ -92,6 +92,11 @@ func (e RoundEventParam) NextDKGRegisterHeight() uint64 {
return e.BeginHeight + e.Config.RoundLength/2
}
+// RoundEndHeight returns the round ending height of this round event.
+func (e RoundEventParam) RoundEndHeight() uint64 {
+ return e.BeginHeight + e.Config.RoundLength
+}
+
func (e RoundEventParam) String() string {
return fmt.Sprintf("roundEvtParam{Round:%d Reset:%d Height:%d}",
e.Round,
@@ -179,7 +184,12 @@ func NewRoundEvent(parentCtx context.Context, gov governanceAccessor,
e.ctx, e.ctxCancel = context.WithCancel(parentCtx)
e.config = RoundBasedConfig{}
e.config.SetupRoundBasedFields(initRound, initConfig)
- e.config.SetRoundBeginHeight(gov.GetRoundHeight(initRound))
+ // TODO(jimmy): remove -1 after we match the height with fullnode.
+ roundHeight := gov.GetRoundHeight(initRound)
+ if initRound != 0 {
+ roundHeight--
+ }
+ e.config.SetRoundBeginHeight(roundHeight)
// Make sure the DKG reset count in current governance can cover the initial
// block height.
resetCount := gov.DKGResetCount(initRound + 1)