mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-15 12:50:47 +02:00
Fail gracefully in block verifier when blockchain not available (#216)
This commit is contained in:
parent
c53c4b4205
commit
089e0d8fbf
1 changed files with 6 additions and 3 deletions
|
|
@ -13,10 +13,13 @@ class SqueakBlockVerifier:
|
|||
def verify_squeak_block(self, squeak_hash):
|
||||
logger.info("Verifying squeak hash: {}".format(squeak_hash))
|
||||
squeak = self._get_squeak(squeak_hash)
|
||||
block_info = self._get_block_info_for_height(squeak.nBlockHeight)
|
||||
|
||||
logger.info("Checking block height: {}".format(squeak.nBlockHeight))
|
||||
logger.info("Checking block hash: {}".format(squeak.hashBlock.hex()))
|
||||
try:
|
||||
block_info = self._get_block_info_for_height(squeak.nBlockHeight)
|
||||
except Exception as e:
|
||||
logger.error("Failed to sync because unable to get blockchain info.", exc_info=True)
|
||||
return
|
||||
|
||||
if squeak.hashBlock.hex() == block_info.block_hash:
|
||||
logger.info("block hash correct: {}".format(block_info))
|
||||
self._mark_squeak_verified(squeak_hash, block_info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue