41
41
from chia .consensus .get_block_generator import get_block_generator
42
42
from chia .consensus .pot_iterations import calculate_ip_iters , calculate_iterations_quality , calculate_sp_iters
43
43
from chia .consensus .signage_point import SignagePoint
44
+ from chia .full_node .block_store import UnsupportedDatabaseVersionError
44
45
from chia .full_node .coin_store import CoinStore
45
46
from chia .full_node .fee_estimator_interface import FeeEstimatorInterface
46
47
from 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
1457
1458
blocks_bytes = await self .full_node .block_store .get_block_bytes_in_range (
1458
1459
request .start_height , request .end_height
1459
1460
)
1460
- except NotImplementedError :
1461
+ except ValueError :
1462
+ return make_msg (ProtocolMessageTypes .reject_block_headers , reject )
1463
+ except UnsupportedDatabaseVersionError :
1461
1464
# The underlying block store may not support this optimized call
1462
1465
# (e.g. v1 DB). In this case, we fall back to the legacy approach
1463
1466
height_to_hash = self .full_node .blockchain .height_to_hash
@@ -1469,8 +1472,6 @@ async def request_block_headers(self, request: wallet_protocol.RequestBlockHeade
1469
1472
header_hashes .append (header_hash )
1470
1473
1471
1474
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 )
1474
1475
if len (blocks_bytes ) != (request .end_height - request .start_height + 1 ): # +1 because interval is inclusive
1475
1476
return make_msg (ProtocolMessageTypes .reject_block_headers , reject )
1476
1477
return_filter = request .return_filter
0 commit comments