Method: Bitcoin::Message::BlockTransactionRequest.parse_from_payload
- Defined in:
- lib/bitcoin/message/block_transaction_request.rb
.parse_from_payload(payload) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bitcoin/message/block_transaction_request.rb', line 16 def self.parse_from_payload(payload) buf = StringIO.new(payload) block_hash = buf.read(32).bth index_len = Bitcoin.unpack_var_int_from_io(buf) indexes = index_len.times.map{Bitcoin.unpack_var_int_from_io(buf)} # index data differentially encoded offset = 0 index_len.times do |i| index = indexes[i] index += offset indexes[i] = index offset = index + 1 end self.new(block_hash, indexes) end |