Sha256: 9f13aefb5122b6c336ea8e7a4757f90829e270867d665605007c623f4ca31613

Contents?: true

Size: 649 Bytes

Versions: 13

Compression:

Stored size: 649 Bytes

Contents

module Bitcoin
  module Message

    # notfound message
    # https://bitcoin.org/en/developer-reference#notfound
    class NotFound < Base

      attr_accessor :inventory

      COMMAND = 'notfound'

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

      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

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

    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bitcoinrb-0.2.2 lib/bitcoin/message/not_found.rb
bitcoinrb-0.2.1 lib/bitcoin/message/not_found.rb
bitcoinrb-0.2.0 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.9 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.8 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.7 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.6 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.5 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.4 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.3 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.2 lib/bitcoin/message/not_found.rb
bitcoinrb-0.1.1 lib/bitcoin/message/not_found.rb
bitcoinrb-0.0.1 lib/bitcoin/message/not_found.rb