Filter old blocks (#237)

This commit is contained in:
KirillPamPam
2023-06-29 14:17:53 +04:00
committed by GitHub
parent aff954b533
commit d921653bad
2 changed files with 34 additions and 3 deletions

View File

@@ -22,7 +22,8 @@ class PriorityForkChoice : ForkChoice {
override fun filter(block: BlockContainer): Boolean {
val curr = head.get()
return (curr == null || curr.nodeRating <= block.nodeRating) && seenBlocks.getIfPresent(block.hash) == null
return (curr == null || curr.nodeRating <= block.nodeRating) && seenBlocks.getIfPresent(block.hash) == null &&
block.height >= (curr?.height?.minus(10) ?: 0)
}
override fun choose(block: BlockContainer): ForkChoice.ChoiceResult {