Skip to content

Commit

Permalink
Reuse generate() logic to wait on hub
Browse files Browse the repository at this point in the history
instead of half-baked reorg() logic.
  • Loading branch information
moodyjon committed Sep 6, 2022
1 parent b328f7a commit 3830a3f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions tests/integration/takeovers/test_resolve_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1555,18 +1555,10 @@ async def reorg(self, start):
blocks = self.ledger.headers.height - start
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
await self.blockchain.invalidate_block((await self.ledger.headers.hash(start)).decode())
# go to previous + 1
await self.blockchain.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)
await self.generate(blocks + 2)

async def assertBlockHash(self, height):
reader_db = self.conductor.spv_node.server.db
Expand Down

0 comments on commit 3830a3f

Please sign in to comment.