diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-09-12 15:35:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 15:35:24 +0800 |
commit | b4af97dd8cfd5bbd7032fb5e1aff240625df06cb (patch) | |
tree | 7cfd54754cc8dbdb6a3165cf7b1ba3af0ab88986 /blockdb/memory_test.go | |
parent | 743983c82b601e200fa53d4aa8973f83ff628d29 (diff) | |
download | dexon-consensus-b4af97dd8cfd5bbd7032fb5e1aff240625df06cb.tar dexon-consensus-b4af97dd8cfd5bbd7032fb5e1aff240625df06cb.tar.gz dexon-consensus-b4af97dd8cfd5bbd7032fb5e1aff240625df06cb.tar.bz2 dexon-consensus-b4af97dd8cfd5bbd7032fb5e1aff240625df06cb.tar.lz dexon-consensus-b4af97dd8cfd5bbd7032fb5e1aff240625df06cb.tar.xz dexon-consensus-b4af97dd8cfd5bbd7032fb5e1aff240625df06cb.tar.zst dexon-consensus-b4af97dd8cfd5bbd7032fb5e1aff240625df06cb.zip |
core: replace acks with slice (#102)
Diffstat (limited to 'blockdb/memory_test.go')
-rw-r--r-- | blockdb/memory_test.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/blockdb/memory_test.go b/blockdb/memory_test.go index 5c1261d..9a3cfa2 100644 --- a/blockdb/memory_test.go +++ b/blockdb/memory_test.go @@ -44,7 +44,7 @@ func (s *MemBackedBlockDBTestSuite) SetupSuite() { Position: types.Position{ Height: 0, }, - Acks: make(map[common.Hash]struct{}), + Acks: common.NewSortedHashes(common.Hashes{}), } s.b01 = &types.Block{ ProposerID: s.v0, @@ -53,9 +53,7 @@ func (s *MemBackedBlockDBTestSuite) SetupSuite() { Position: types.Position{ Height: 1, }, - Acks: map[common.Hash]struct{}{ - s.b00.Hash: struct{}{}, - }, + Acks: common.NewSortedHashes(common.Hashes{s.b00.Hash}), } s.b02 = &types.Block{ ProposerID: s.v0, @@ -64,9 +62,7 @@ func (s *MemBackedBlockDBTestSuite) SetupSuite() { Position: types.Position{ Height: 2, }, - Acks: map[common.Hash]struct{}{ - s.b01.Hash: struct{}{}, - }, + Acks: common.NewSortedHashes(common.Hashes{s.b01.Hash}), } } @@ -118,14 +114,14 @@ func (s *MemBackedBlockDBTestSuite) TestIteration() { // Check if we can iterate all 3 blocks. iter, err := db.GetAll() s.Require().Nil(err) - touched := map[common.Hash]struct{}{} + touched := common.Hashes{} for { b, err := iter.Next() if err == ErrIterationFinished { break } s.Require().Nil(err) - touched[b.Hash] = struct{}{} + touched = append(touched, b.Hash) } s.Len(touched, 3) s.Contains(touched, s.b00.Hash) |