aboutsummaryrefslogtreecommitdiffstats
path: root/core/compaction-chain_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/compaction-chain_test.go')
-rw-r--r--core/compaction-chain_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/compaction-chain_test.go b/core/compaction-chain_test.go
index e944e4d..ca88734 100644
--- a/core/compaction-chain_test.go
+++ b/core/compaction-chain_test.go
@@ -201,6 +201,7 @@ func (s *CompactionChainTestSuite) TestMissedRandomness() {
cc.registerBlock(blocks[idx])
s.Require().True(cc.blockRegistered(blocks[idx].Hash))
}
+ noRandBlocks := common.Hashes{}
// Block#4, #5, contains randomness.
for i := range blocks {
s.Require().NoError(cc.processBlock(blocks[i]))
@@ -212,8 +213,11 @@ func (s *CompactionChainTestSuite) TestMissedRandomness() {
Position: blocks[i].Position,
Randomness: h[:],
}))
+ } else {
+ noRandBlocks = append(noRandBlocks, blocks[i].Hash)
}
}
+ s.Equal(noRandBlocks, cc.pendingBlocksWithoutRandomness())
s.Require().Len(cc.extractBlocks(), 0)
// Give compactionChain module randomnessResult via finalized block
// #0, #1, #2, #3, #4.
@@ -227,6 +231,9 @@ func (s *CompactionChainTestSuite) TestMissedRandomness() {
block.Finalization.Height = uint64(i + 1)
cc.processFinalizedBlock(block)
}
+ // Block #0-3 has randomness result.
+ noRandBlocks = noRandBlocks[4:]
+ s.Equal(noRandBlocks, cc.pendingBlocksWithoutRandomness())
delivered := cc.extractBlocks()
s.Require().Len(delivered, 6)
// Give compactionChain module randomnessResult#6-9.
@@ -239,6 +246,7 @@ func (s *CompactionChainTestSuite) TestMissedRandomness() {
Randomness: h[:],
}))
}
+ s.Len(cc.pendingBlocksWithoutRandomness(), 0)
delivered = append(delivered, cc.extractBlocks()...)
s.Require().Len(delivered, 10)
// The delivered order should be the same as processing order.