lib/dcha/peer/can_heartbeat.rb in dcha-0.1.2 vs lib/dcha/peer/can_heartbeat.rb in dcha-0.1.3
- old
+ new
@@ -5,12 +5,12 @@
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 action: :mine, params: [chain.blocks]
+ return if ipaddr.ip_address == address
transmit_to address, action: :pong, params: [ipaddr.ip_address]
end
end
end
end