lib/dcha/peer/can_heartbeat.rb in dcha-0.1.3 vs lib/dcha/peer/can_heartbeat.rb in dcha-0.1.4

- old
+ new

@@ -5,13 +5,15 @@ 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 ipaddr.ip_address == address - transmit_to address, action: :pong, params: [ipaddr.ip_address] + transmit_to address, action: :add_peer, params: [ipaddr.ip_address] + end + + def add_peer(address) + @peers.push(address).uniq! end end end end