mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-20 16:08:51 +03:00
Fix Newer block issue (#11486)
* Fix Newer block issue * Fallback to checking memory
This commit is contained in:
parent
9a07247e1f
commit
ce92f36055
@ -470,7 +470,11 @@ class FullNodeRpcApi:
|
||||
|
||||
newer_block = await self.service.block_store.get_block_record(newer_block_bytes)
|
||||
if newer_block is None:
|
||||
raise ValueError(f"Newer block {newer_block_hex} not found")
|
||||
# It's possible that the peak block has not yet been committed to the DB, so as a fallback, check memory
|
||||
try:
|
||||
newer_block = self.service.blockchain.block_record(newer_block_bytes)
|
||||
except KeyError:
|
||||
raise ValueError(f"Newer block {newer_block_hex} not found")
|
||||
older_block = await self.service.block_store.get_block_record(older_block_bytes)
|
||||
if older_block is None:
|
||||
raise ValueError(f"Older block {older_block_hex} not found")
|
||||
|
Loading…
Reference in New Issue
Block a user