class Tapyrus::Message::BlockTransactions
BIP-152 Compact Block's data format. github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#BlockTransactions
Attributes
block_hash[RW]
transactions[RW]
Public Class Methods
new(block_hash, transactions)
click to toggle source
# File lib/tapyrus/message/block_transactions.rb, line 9 def initialize(block_hash, transactions) @block_hash = block_hash @transactions = transactions end
parse_from_payload(payload)
click to toggle source
# File lib/tapyrus/message/block_transactions.rb, line 14 def self.parse_from_payload(payload) buf = StringIO.new(payload) block_hash = buf.read(32).bth tx_count = Tapyrus.unpack_var_int_from_io(buf) txn = tx_count.times.map { Tapyrus::Tx.parse_from_payload(buf) } self.new(block_hash, txn) end
Public Instance Methods
to_payload()
click to toggle source
# File lib/tapyrus/message/block_transactions.rb, line 22 def to_payload block_hash.htb << Tapyrus.pack_var_int(transactions.size) << transactions.map(&:to_payload).join end