Sha256: 3fa4d411a33020e03e16dabb4b192609bdbf714e962a855cc92f51bb232e1a15

Contents?: true

Size: 406 Bytes

Versions: 1

Compression:

Stored size: 406 Bytes

Contents

module Dcha
  class Peer
    # :nodoc:
    module CanHeartbeat
      def ping
        transmit action: :pong, params: [ipaddr.ip_address]
      end

      def pong(address)
        @peers.push(address).uniq!
        transmit action: :mine, params: [chain.blocks]
        return if @peers.include?(address)
        transmit_to address, action: :pong, params: [ipaddr.ip_address]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dcha-0.1.1 lib/dcha/peer/can_heartbeat.rb