Reuse generate() logic to wait on hub
instead of half-baked reorg() logic.
This commit is contained in:
parent
d2738c2e72
commit
45a255e7a2
1 changed files with 1 additions and 9 deletions
|
@ -1555,18 +1555,10 @@ class ResolveAfterReorg(BaseResolveTestCase):
|
||||||
blocks = self.ledger.headers.height - start
|
blocks = self.ledger.headers.height - start
|
||||||
self.blockchain.block_expected = start - 1
|
self.blockchain.block_expected = start - 1
|
||||||
|
|
||||||
|
|
||||||
prepare = self.ledger.on_header.where(self.blockchain.is_expected_block)
|
|
||||||
self.conductor.spv_node.server.synchronized.clear()
|
|
||||||
|
|
||||||
# go back to start
|
# go back to start
|
||||||
await self.blockchain.invalidate_block((await self.ledger.headers.hash(start)).decode())
|
await self.blockchain.invalidate_block((await self.ledger.headers.hash(start)).decode())
|
||||||
# go to previous + 1
|
# go to previous + 1
|
||||||
await self.blockchain.generate(blocks + 2)
|
await self.generate(blocks + 2)
|
||||||
|
|
||||||
await prepare # no guarantee that it didn't happen already, so start waiting from before calling generate
|
|
||||||
await self.conductor.spv_node.server.synchronized.wait()
|
|
||||||
# await asyncio.wait_for(self.on_header(self.blockchain.block_expected), 30.0)
|
|
||||||
|
|
||||||
async def assertBlockHash(self, height):
|
async def assertBlockHash(self, height):
|
||||||
reader_db = self.conductor.spv_node.server.db
|
reader_db = self.conductor.spv_node.server.db
|
||||||
|
|
Loading…
Reference in a new issue