Method: Bitcoin::Message::BlockTransactions.parse_from_payload

Defined in:
lib/bitcoin/message/block_transactions.rb

.parse_from_payload(payload) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/bitcoin/message/block_transactions.rb', line 16

def self.parse_from_payload(payload)
  buf = StringIO.new(payload)
  block_hash = buf.read(32).bth
  tx_count = Bitcoin.unpack_var_int_from_io(buf)
  txn = tx_count.times.map{Bitcoin::Tx.parse_from_payload(buf)}
  self.new(block_hash, txn)
end