4141from chia .consensus .get_block_generator import get_block_generator
4242from chia .consensus .pot_iterations import calculate_ip_iters , calculate_iterations_quality , calculate_sp_iters
4343from chia .consensus .signage_point import SignagePoint
44+ from chia .full_node .block_store import UnsupportedDatabaseVersionError
4445from chia .full_node .coin_store import CoinStore
4546from chia .full_node .fee_estimator_interface import FeeEstimatorInterface
4647from chia .full_node .full_block_utils import get_height_and_tx_status_from_block , header_block_from_block
@@ -1457,7 +1458,9 @@ async def request_block_headers(self, request: wallet_protocol.RequestBlockHeade
14571458 blocks_bytes = await self .full_node .block_store .get_block_bytes_in_range (
14581459 request .start_height , request .end_height
14591460 )
1460- except NotImplementedError :
1461+ except ValueError :
1462+ return make_msg (ProtocolMessageTypes .reject_block_headers , reject )
1463+ except UnsupportedDatabaseVersionError :
14611464 # The underlying block store may not support this optimized call
14621465 # (e.g. v1 DB). In this case, we fall back to the legacy approach
14631466 height_to_hash = self .full_node .blockchain .height_to_hash
@@ -1469,8 +1472,6 @@ async def request_block_headers(self, request: wallet_protocol.RequestBlockHeade
14691472 header_hashes .append (header_hash )
14701473
14711474 blocks_bytes = await self .full_node .block_store .get_block_bytes_by_hash (header_hashes )
1472- except ValueError :
1473- return make_msg (ProtocolMessageTypes .reject_block_headers , reject )
14741475 if len (blocks_bytes ) != (request .end_height - request .start_height + 1 ): # +1 because interval is inclusive
14751476 return make_msg (ProtocolMessageTypes .reject_block_headers , reject )
14761477 return_filter = request .return_filter
0 commit comments