Module: Dcha::Peer::CanHeartbeat

Included in:
Dcha::Peer
Defined in:
lib/dcha/peer/can_heartbeat.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#pingObject



5
6
7
# File 'lib/dcha/peer/can_heartbeat.rb', line 5

def ping
  transmit action: :pong, params: [ipaddr.ip_address]
end

#pong(address) ⇒ Object



9
10
11
12
13
14
# File 'lib/dcha/peer/can_heartbeat.rb', line 9

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