code: def get_index_range(working_dir):
      
  
      bitcoind_session = get_bitcoind(new=True)
      assert bitcoind_session is not None
  
      first_block = None
      last_block = None
      wait = 1.0
      while last_block is None and is_running():
  
          first_block, last_block = virtualchain.get_index_range('bitcoin', bitcoind_session, virtualchain_hooks, working_dir)
  
          if first_block is None or last_block is None:
  
              # try to reconnnect
              log.error("Reconnect to bitcoind in {} seconds".format(wait))
              time.sleep(wait)
              wait = min(wait * 2.0 + random.random() * wait, 60)
  
              bitcoind_session = get_bitcoind( new=True )
              continue
  
          else:
              return first_block, last_block - NUM_CONFIRMATIONS
  
      return None, None
docs: 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.