Sha256: b46f17fbf5284cbd9e7c38453e4f55681c88203b3bcd4971f2d52a4349f3d5d9
Contents?: true
Size: 790 Bytes
Versions: 6
Compression:
Stored size: 790 Bytes
Contents
module Bitcoin module Message # sendcmpct message # https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki class SendCmpct < Base COMMAND = 'sendcmpct' MODE_HIGH = 1 MODE_LOW = 0 attr_accessor :mode attr_accessor :version # TODO support version 2 def initialize(mode, version) @mode = mode @version = version end def self.parse_from_payload(payload) buf = StringIO.new(payload) mode = buf.read(1).unpack('c').first version = buf.read(8).unpack('Q').first new(mode, version) end def to_payload [mode, version].pack('cQ') end def high? mode == 1 end def low? mode.zero? end end end end
Version data entries
6 entries across 6 versions & 1 rubygems