diff options
-rw-r--r-- | Gopkg.lock | 25 | ||||
-rw-r--r-- | core/consensus.go | 6 | ||||
-rw-r--r-- | core/test/governance.go | 3 | ||||
-rw-r--r-- | core/utils/round-event.go | 3 |
4 files changed, 33 insertions, 4 deletions
@@ -122,13 +122,38 @@ analyzer-name = "dep" analyzer-version = 1 input-imports = [ + "github.com/btcsuite/btcd/btcec", + "github.com/davecgh/go-spew/spew", "github.com/dexon-foundation/bls/ffi/go/bls", + "github.com/dexon-foundation/dexon/common", + "github.com/dexon-foundation/dexon/common/hexutil", + "github.com/dexon-foundation/dexon/common/math", "github.com/dexon-foundation/dexon/crypto", + "github.com/dexon-foundation/dexon/crypto/secp256k1", + "github.com/dexon-foundation/dexon/crypto/sha3", "github.com/dexon-foundation/dexon/log", "github.com/dexon-foundation/dexon/rlp", + "github.com/go-stack/stack", + "github.com/golang/snappy", + "github.com/naoina/go-stringutil", "github.com/naoina/toml", + "github.com/naoina/toml/ast", + "github.com/pmezard/go-difflib/difflib", + "github.com/stretchr/testify/assert", + "github.com/stretchr/testify/require", "github.com/stretchr/testify/suite", "github.com/syndtr/goleveldb/leveldb", + "github.com/syndtr/goleveldb/leveldb/cache", + "github.com/syndtr/goleveldb/leveldb/comparer", + "github.com/syndtr/goleveldb/leveldb/errors", + "github.com/syndtr/goleveldb/leveldb/filter", + "github.com/syndtr/goleveldb/leveldb/iterator", + "github.com/syndtr/goleveldb/leveldb/journal", + "github.com/syndtr/goleveldb/leveldb/memdb", + "github.com/syndtr/goleveldb/leveldb/opt", + "github.com/syndtr/goleveldb/leveldb/storage", + "github.com/syndtr/goleveldb/leveldb/table", + "github.com/syndtr/goleveldb/leveldb/util", ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/core/consensus.go b/core/consensus.go index 4a95eac..a02f8c1 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -733,7 +733,8 @@ func newConsensusForRound( } baConfig := agreementMgrConfig{} baConfig.from(initRound, initConfig, initCRS) - baConfig.SetRoundBeginHeight(gov.GetRoundHeight(initRound)) + // TODO(jimmy): remove -1 after we match the height with fullnode. + baConfig.SetRoundBeginHeight(gov.GetRoundHeight(initRound) - 1) con.baMgr, err = newAgreementMgr(con, baConfig) if err != nil { panic(err) @@ -809,7 +810,8 @@ func (con *Consensus) prepare(initBlock *types.Block) (err error) { panic(err) } // The init config is provided to baModule when construction. - if evts[len(evts)-1].BeginHeight != con.gov.GetRoundHeight(initRound) { + // TODO(jimmy): remove -1 after we match the height with fullnode. + if evts[len(evts)-1].BeginHeight != con.gov.GetRoundHeight(initRound)-1 { if err := con.baMgr.notifyRoundEvents(evts); err != nil { panic(err) } diff --git a/core/test/governance.go b/core/test/governance.go index 538d064..4970420 100644 --- a/core/test/governance.go +++ b/core/test/governance.go @@ -100,7 +100,8 @@ func (g *Governance) GetRoundHeight(round uint64) uint64 { panic(fmt.Errorf("round begin height is not ready: %d %d", round, len(g.roundBeginHeights))) } - return g.roundBeginHeights[round] + // TODO(jimmy): remove this workaround. + return g.roundBeginHeights[round] + 1 } // CRS returns the CRS for a given round. diff --git a/core/utils/round-event.go b/core/utils/round-event.go index 885c755..c03a2fd 100644 --- a/core/utils/round-event.go +++ b/core/utils/round-event.go @@ -179,7 +179,8 @@ 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. + e.config.SetRoundBeginHeight(gov.GetRoundHeight(initRound) - 1) // Make sure the DKG reset count in current governance can cover the initial // block height. resetCount := gov.DKGResetCount(initRound + 1) |