Class: Bitcoin::Message::NotFound

Inherits:
Base show all
Defined in:
lib/bitcoin/message/not_found.rb

Overview

Constant Summary collapse

COMMAND =
'notfound'

Constants included from Util

Util::DIGEST_NAME_SHA256

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_pkt

Methods included from Util

#byte_to_bit, #calc_checksum, #decode_base58_address, #double_sha256, #encode_base58_address, #hash160, #hmac_sha256, #pack_boolean, #pack_var_int, #pack_var_string, #sha256, #unpack_boolean, #unpack_var_int, #unpack_var_int_from_io, #unpack_var_string

Constructor Details

#initialize(identifier, hash) ⇒ NotFound



12
13
14
# File 'lib/bitcoin/message/not_found.rb', line 12

def initialize(identifier, hash)
  @inventory = Inventory.new(identifier, hash)
end

Instance Attribute Details

#inventoryObject

Returns the value of attribute inventory.



8
9
10
# File 'lib/bitcoin/message/not_found.rb', line 8

def inventory
  @inventory
end

Class Method Details

.parse_from_payload(payload) ⇒ Object



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

def self.parse_from_payload(payload)
  size, inventory_payload = Bitcoin.unpack_var_int(payload)
  inventory = Inventory.parse_from_payload(inventory_payload)
  new(inventory.identifier, inventory.hash)
end

Instance Method Details

#to_payloadObject



22
23
24
# File 'lib/bitcoin/message/not_found.rb', line 22

def to_payload
  Bitcoin.pack_var_int(1) << inventory.to_payload
end