From 1a10172a7c36f44ddfb202420efd7a09d1405b5b Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 17 Nov 2023 23:49:11 +0100 Subject: [PATCH] fix logic in get_block_generator() that determines whether we're looking up a block from a fork or the main chain --- chia/consensus/blockchain.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/chia/consensus/blockchain.py b/chia/consensus/blockchain.py index 8ee0850f08be..d0fc9f260a6d 100644 --- a/chia/consensus/blockchain.py +++ b/chia/consensus/blockchain.py @@ -1100,11 +1100,8 @@ async def get_block_generator( return BlockGenerator(block.transactions_generator, [], []) result: List[SerializedProgram] = [] - previous_block_hash = block.prev_header_hash - if ( - self.try_block_record(previous_block_hash) - and self.height_to_hash(self.block_record(previous_block_hash).height) == previous_block_hash - ): + previous_br = await self.get_block_record_from_db(block.prev_header_hash) + if previous_br is not None and self.height_to_hash(previous_br.height) == block.prev_header_hash: # We are not in a reorg, no need to look up alternate header hashes # (we can get them from height_to_hash) # in the v2 database, we can look up blocks by height directly