Sha256: f9a569f5a2b55677d3eaad7ba30c03851c9817edd742849b76c5e58e12cc98db

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)
        transmit action: :mine, params: [chain.blocks]
        transmit_to address, action: :add_peer, params: [ipaddr.ip_address]
      end

      def add_peer(address)
        @peers.push(address).uniq!
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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