Class: BitcoinNode::Protocol::Inv

Inherits:
Payload
  • Object
show all
Defined in:
lib/bitcoin_node/protocol/payloads.rb

Class Method Summary collapse

Methods inherited from Payload

#bytesize, defaults, field, field_names, fields, #initialize, #name, #raw, #to_s, #type

Constructor Details

This class inherits a constructor from BitcoinNode::Protocol::Payload

Class Method Details

.parse(raw) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/bitcoin_node/protocol/payloads.rb', line 35

def self.parse(raw)
  count, payload = VariableIntegerField.parse(raw)  
  invs = Array.new(count) do
    inv, payload = InventoryVectorField.parse(payload)
    inv
  end
  new(count: count, inventory_list: invs)
end