Sha256: 6620feec6a63088002ef61e8f0bf51009354c7a200bd5b2e029298ec539009a6
Contents?: true
Size: 516 Bytes
Versions: 24
Compression:
Stored size: 516 Bytes
Contents
module Bitcoin module Message # ping message class # https://bitcoin.org/en/developer-reference#ping class Ping < Base COMMAND = 'ping' attr_accessor :nonce def initialize(nonce = SecureRandom.random_number(0xffffffff)) @nonce = nonce end def self.parse_from_payload(payload) new(payload.unpack('Q').first) end def to_payload [nonce].pack('Q') end def to_response Pong.new(nonce) end end end end
Version data entries
24 entries across 24 versions & 1 rubygems