def receive_status(proto, blockhash, chain_difficulty)
      logger.debug 'status received', proto: proto, chain_difficulty: chain_difficulty

      @protocols[proto] = chain_difficulty

      if @chainservice.knows_block(blockhash) || @synctask
        logger.debug 'existing task or known hash, discarding'
        return
      end

      if @force_sync
        blockhash, difficulty = force_sync
        logger.debug 'starting forced synctask', blockhash: Utils.encode_hex(blockhash)
        @synctask = SyncTask.new self, proto, blockhash, difficulty
      elsif chain_difficulty > @chain.head.chain_difficulty
        logger.debug 'sufficient difficulty'
        @synctask = SyncTask.new self, proto, blockhash, chain_difficulty
      end
    rescue
      logger.debug $!
      logger.debug $!.backtrace[0,10].join("\n")
    end
def receive_status(proto, blockhash, chain_difficulty)
      logger.debug 'status received', proto: proto, chain_difficulty: chain_difficulty

      @protocols[proto] = chain_difficulty

      if @chainservice.knows_block(blockhash) || @synctask
        logger.debug 'existing task or known hash, discarding'
        return
      end

      if @force_sync
        blockhash, difficulty = force_sync
        logger.debug 'starting forced synctask', blockhash: Utils.encode_hex(blockhash)
        @synctask = SyncTask.new self, proto, blockhash, difficulty
      elsif chain_difficulty > @chain.head.chain_difficulty
        logger.debug 'sufficient difficulty'
        @synctask = SyncTask.new self, proto, blockhash, chain_difficulty
      end
    rescue
      logger.debug $!
      logger.debug $!.backtrace[0,10].join("\n")
    end
Called if a new peer is connected.