Sha256: 0c161d6d3cadbf56754891b6b3fbd2637072d1fcb19de8f88a3bf5054c71ec4d

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)
        return if @peers.include?(address)
        transmit action: :mine, params: [chain.blocks]
        @peers.push(address).uniq!
        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.2 lib/dcha/peer/can_heartbeat.rb