class Bitcoin::Message::CFilter

cfilter message for BIP-157 github.com/bitcoin/bips/blob/master/bip-0157.mediawiki#cfilter

Constants

COMMAND

Attributes

block_hash[RW]
filter[RW]
filter_type[RW]

Public Class Methods

new(filter_type, block_hash, filter) click to toggle source
# File lib/bitcoin/message/cfilter.rb, line 14
def initialize(filter_type, block_hash, filter)
  @filter_type = filter_type
  @block_hash = block_hash
  @filter = filter
end
parse_from_payload(payload) click to toggle source
# File lib/bitcoin/message/cfilter.rb, line 20
def self.parse_from_payload(payload)
  buf = StringIO.new(payload)
  type = buf.read(1).unpack1("C")
  hash = buf.read(32).bth
  len = Bitcoin.unpack_var_int_from_io(buf)
  filter = buf.read(len).bth
  self.new(type, hash, filter)
end

Public Instance Methods

to_payload() click to toggle source
# File lib/bitcoin/message/cfilter.rb, line 29
def to_payload
  [filter_type, block_hash].pack('CH*') + Bitcoin.pack_var_string(filter.htb)
end