class Bitcoin::Message::CFCheckpt
cfcheckpt message for BIP-157 github.com/bitcoin/bips/blob/master/bip-0157.mediawiki#cfcheckpt
Constants
- COMMAND
Attributes
filter_headers[RW]
filter_type[RW]
stop_hash[RW]
Public Class Methods
new(filter_type, stop_hash, filter_headers)
click to toggle source
# File lib/bitcoin/message/cfcheckpt.rb, line 14 def initialize(filter_type, stop_hash, filter_headers) @filter_type = filter_type @stop_hash = stop_hash @filter_headers = filter_headers end
parse_from_payload(payload)
click to toggle source
# File lib/bitcoin/message/cfcheckpt.rb, line 20 def self.parse_from_payload(payload) buf = StringIO.new(payload) type = buf.read(1).unpack1('C') hash = buf.read(32).unpack1('H*') count = Bitcoin.unpack_var_int_from_io(buf) headers = count.times.map{buf.read(32).bth} self.new(type, hash, headers) end
Public Instance Methods
to_payload()
click to toggle source
# File lib/bitcoin/message/cfcheckpt.rb, line 29 def to_payload [filter_type, stop_hash].pack('CH*') + Bitcoin.pack_var_int(filter_headers.size) + filter_headers.map(&:htb).join end