def rescan_if_missed_blocks(store):
 (bad,) = store.selectrow('\n        SELECT COUNT(1)\n          FROM block\n          LEFT JOIN chain_candidate USING (block_id)\n         WHERE chain_id IS NULL\n    ')
 if (bad > 0):
  store.sql('UPDATE datadir SET blkfile_number = 1, blkfile_offset = 0')

def rescan_if_missed_blocks ( store ) : ( bad , ) = store . selectrow ( '\n        SELECT COUNT(1)\n          FROM block\n          LEFT JOIN chain_candidate USING (block_id)\n         WHERE chain_id IS NULL\n    ' ) if ( bad > 0 ) : store . sql ( 'UPDATE datadir SET blkfile_number = 1, blkfile_offset = 0' )
due to a bug .