Skip to content

Commit

Permalink
don't catch unexpected error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Jan 10, 2025
1 parent e6bd184 commit 2674038
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions counterparty-core/counterpartycore/lib/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,13 +1274,7 @@ def handle_reorg(db):
# search last block with the correct hash
previous_block_index = util.CURRENT_BLOCK_INDEX - 1
while True:
try:
previous_block_hash = backend.bitcoind.getblockhash(previous_block_index)
except exceptions.BlockOutOfRange:
# previous block and current block are not in the blockchain
logger.debug(f"Previous block is not in the blockchain ({previous_block_index}).")
previous_block_index -= 2
continue
previous_block_hash = backend.bitcoind.getblockhash(previous_block_index)

try:
current_block_hash = backend.bitcoind.getblockhash(previous_block_index + 1)
Expand All @@ -1303,6 +1297,7 @@ def handle_reorg(db):
rollback(db, block_index=current_block_index)
util.CURRENT_BLOCK_INDEX = previous_block_index

# get the new deserialized current block
current_block = deserialize.deserialize_block(
backend.bitcoind.getblock(current_block_hash),
parse_vouts=True,
Expand Down

0 comments on commit 2674038

Please sign in to comment.