Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Karim TAAM <[email protected]>
  • Loading branch information
matkt committed Jun 28, 2021
1 parent 4b799ab commit 80499e7
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,18 @@ public void shouldReplaceLowestPriorityBlockWhenCacheIsFull() {
}
assertThat(pendingBlocksManager.contains(reorgBlock.getHash())).isTrue();
}

@Test
public void shouldReturnLowestBlockByNumber() {
final BlockDataGenerator gen = new BlockDataGenerator();
final Block parentBlock = gen.block();
final Block childBlock = gen.nextBlock(parentBlock);
final Block childBlock2 = gen.nextBlock(parentBlock);

pendingBlocksManager.registerPendingBlock(parentBlock, NODE_ID_1);
pendingBlocksManager.registerPendingBlock(childBlock, NODE_ID_1);
pendingBlocksManager.registerPendingBlock(childBlock2, NODE_ID_1);

assertThat(pendingBlocksManager.lowestAnnouncedBlock()).contains(parentBlock.getHeader());
}
}

0 comments on commit 80499e7

Please sign in to comment.