diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-11 13:28:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 13:28:44 +0800 |
commit | 582a491aa0bcb784ac7b65ebbfb42139945ea703 (patch) | |
tree | 8589bad986f512455717728012c3d9edf3b68c4f /core/consensus_test.go | |
parent | 2439f49063d8498eadf26d4fa1220c5eac8412a8 (diff) | |
download | tangerine-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar.gz tangerine-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.tar.zst tangerine-consensus-582a491aa0bcb784ac7b65ebbfb42139945ea703.zip |
core: timestamp (#98)
Diffstat (limited to 'core/consensus_test.go')
-rw-r--r-- | core/consensus_test.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/consensus_test.go b/core/consensus_test.go index aec0e4c..a66a459 100644 --- a/core/consensus_test.go +++ b/core/consensus_test.go @@ -290,7 +290,12 @@ func (s *ConsensusTestSuite) TestSimpleDeliverBlock() { // Check timestamps, there is no direct way to know which block is // selected as main chain, we can only detect it by making sure // its ConsensusTimestamp is not interpolated. - t, err := getMedianTime(b11) + timestamps := make([]time.Time, 4) + timestamps[0] = b00.Timestamp + timestamps[1] = b10.Timestamp + timestamps[2] = b20.Timestamp + timestamps[3] = b30.Timestamp + t, err := getMedianTime(timestamps) req.Nil(err) req.Equal(t, app.Delivered[b11.Hash].ConsensusTime) } @@ -355,8 +360,8 @@ func (s *ConsensusTestSuite) TestPrepareBlock() { // Make sure we would assign 'now' to the timestamp belongs to // the proposer. req.True( - b11.Timestamps[validators[1]].Sub( - b10.Timestamps[validators[1]]) > 100*time.Millisecond) + b11.Timestamp.Sub( + b10.Timestamp) > 100*time.Millisecond) for _, obj := range objs { con := obj.con req.Nil(con.ProcessBlock(b11)) |