diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-10-03 17:48:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 17:48:56 +0800 |
commit | f5f34f81f8f3149adb002c65a7cc0cfa1244f77d (patch) | |
tree | e7b9ce05f6943fcd8f2e4cb17edac9e5272529a0 /core/consensus-timestamp_test.go | |
parent | 3bab25bee98df72a25c273d6de1166facaa6a69e (diff) | |
download | tangerine-consensus-f5f34f81f8f3149adb002c65a7cc0cfa1244f77d.tar.gz tangerine-consensus-f5f34f81f8f3149adb002c65a7cc0cfa1244f77d.tar.zst tangerine-consensus-f5f34f81f8f3149adb002c65a7cc0cfa1244f77d.zip |
core: publish round based config (#165)
Diffstat (limited to 'core/consensus-timestamp_test.go')
-rw-r--r-- | core/consensus-timestamp_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/consensus-timestamp_test.go b/core/consensus-timestamp_test.go index be90f41..ea85c38 100644 --- a/core/consensus-timestamp_test.go +++ b/core/consensus-timestamp_test.go @@ -90,11 +90,12 @@ func (s *ConsensusTimestampTest) extractTimestamps( // TestTimestampPartition verifies that processing segments of compatction chain // should have the same result as processing the whole chain at once. func (s *ConsensusTimestampTest) TestTimestampPartition() { + var round uint64 blockNums := []int{50, 100, 30} chainNum := 19 sigma := 100 * time.Millisecond totalTimestamps := make([]time.Time, 0) - ct := newConsensusTimestamp() + ct := newConsensusTimestamp(round, uint32(chainNum)) totalBlockNum := 0 for _, blockNum := range blockNums { totalBlockNum += blockNum @@ -110,7 +111,7 @@ func (s *ConsensusTimestampTest) TestTimestampPartition() { totalChain = append(totalChain, chain...) totalTimestamps = append(totalTimestamps, timestamps...) } - ct2 := newConsensusTimestamp() + ct2 := newConsensusTimestamp(round, uint32(chainNum)) err := ct2.processBlocks(totalChain) s.Require().NoError(err) timestamps2 := s.extractTimestamps(totalChain) @@ -118,9 +119,10 @@ func (s *ConsensusTimestampTest) TestTimestampPartition() { } func (s *ConsensusTimestampTest) TestTimestampIncrease() { + var round uint64 chainNum := 19 sigma := 100 * time.Millisecond - ct := newConsensusTimestamp() + ct := newConsensusTimestamp(round, uint32(chainNum)) chain := s.generateBlocksWithTimestamp(1000, chainNum, time.Second, sigma) err := ct.processBlocks(chain) s.Require().NoError(err) @@ -129,7 +131,7 @@ func (s *ConsensusTimestampTest) TestTimestampIncrease() { s.False(timestamps[i].Before(timestamps[i-1])) } // Test if the processBlocks is stable. - ct2 := newConsensusTimestamp() + ct2 := newConsensusTimestamp(round, uint32(chainNum)) ct2.processBlocks(chain) s.Require().NoError(err) timestamps2 := s.extractTimestamps(chain) |