def get_index_range(): """ Get the bitcoin block index range. Mask connection failures with timeouts. Always try to reconnect """ bitcoind_session = get_bitcoind( new=True ) first_block = None last_block = None while last_block is None: first_block, last_block = virtualchain.get_index_range( bitcoind_session ) if last_block is None: # try to reconnnect time.sleep(1) log.error("Reconnect to bitcoind") bitcoind_session = get_bitcoind( new=True ) continue else: return first_block, last_block
def get_index_range(): """ Get the bitcoin block index range. Mask connection failures with timeouts. Always try to reconnect. The last block will be the last block to search for names. This will be NUM_CONFIRMATIONS behind the actual last-block the cryptocurrency node knows about. """ bitcoind_session = get_bitcoind( new=True ) first_block = None last_block = None while last_block is None: first_block, last_block = virtualchain.get_index_range( bitcoind_session ) if last_block is None: # try to reconnnect time.sleep(1) log.error("Reconnect to bitcoind") bitcoind_session = get_bitcoind( new=True ) continue else: return first_block, last_block - NUM_CONFIRMATIONS