correct subset check + block verification optimization

This commit is contained in:
AF 2022-07-25 17:09:46 +03:00
parent 30284c8f72
commit 96f200bbd0
3 changed files with 3 additions and 15 deletions

2
faq.md
View File

@ -1,6 +1,6 @@
### Why is `Coroutine[Any, Any, T]` used instead of `Awaitable[T]`? ### Why is `Coroutine[Any, Any, T]` used instead of `Awaitable[T]`?
* Typing issues (PyCharm) * Typing issues (PyCharm)
* Explicit expression of whether some sort of action is performed or not (tasks vs futures vs coros) * Explicit expression of whether some sort of action is performed or not (futures vs coros)
### Why is `subset-verify-optimized` branch closed? ### Why is `subset-verify-optimized` branch closed?
* Performance gain at large set sizes are 0% or less. * Performance gain at large set sizes are 0% or less.

View File

@ -123,6 +123,7 @@ class SubCheck(
if case.tree == self.split.tree: if case.tree == self.split.tree:
return SubTree() return SubTree()
else: else:
assert case.split.key == self.key
return Found() return Found()
async def on_left(self, case: PBS) -> CheckResult: async def on_left(self, case: PBS) -> CheckResult:

View File

@ -150,22 +150,9 @@ class FlowBlockIndexedVerification(
return True return True
async def _verify_previous(self, previous: HashPoint[FBL], block: FBL) -> bool: async def _verify_previous(self, previous: HashPoint[FBL], block: FBL) -> bool:
async def verify_previous_contained() -> bool:
assert_true(await self.index.contains(previous))
return True
async def verify_previous_block() -> bool:
assert_true(await self._verify_previous_block(await previous.resolve(), block)) assert_true(await self._verify_previous_block(await previous.resolve(), block))
return True return True
assert_trues(
await gather(
verify_previous_block(),
verify_previous_contained(),
)
)
return True
async def _verify(self, block: FBL) -> bool: async def _verify(self, block: FBL) -> bool:
assert isinstance(block, FlowBlock) assert isinstance(block, FlowBlock)
if block.previous.null(): if block.previous.null():