Sha256: ecf1e9047802df090a7a273143d8ddf5140e49171aa4c2fb62ae37d51eb77401

Contents?: true

Size: 1.1 KB

Versions: 19

Compression:

Stored size: 1.1 KB

Contents

# encoding: ascii-8bit

require_relative '../spec_helper.rb'

describe 'Bitcoin::Protocol::Parser (notfound)' do

  class Notfound_Handler < Bitcoin::Protocol::Handler
    attr_reader :notfound
    def on_notfound(type, hash); (@notfound ||= []) << [type, hash.hth]; end
  end

  before do
    @parser = Bitcoin::Protocol::Parser.new( @handler = Notfound_Handler.new )
  end

  it 'parses notfound block message' do
    payload = "\x01\x01\x00\x00\x00:\xE2\x93bDJ\x01\xA9|\xDA>0\x8F\a\xA3L\n\xEF\x0E\xD2\xF2\xC6\xCE\xCA(\xD19}\x80*h+"
    @parser.parse(Bitcoin::Protocol.pkt("notfound", payload) + "AAAA").should == "AAAA"
    @handler.notfound.should == [
      [:tx, "2b682a807d39d128cacec6f2d20eef0a4ca3078f303eda7ca9014a446293e23a"]
    ]
  end

  it 'parses notfound tx message' do
    payload = "\x01\x02\x00\x00\x00:\xE2\x93bDJ\x01\xA9|\xDA>0\x8F\a\xA3L\n\xEF\x0E\xD2\xF2\xC6\xCE\xCA(\xD19}\x80*h+"
    @parser.parse(Bitcoin::Protocol.pkt("notfound", payload) + "AAAA").should == "AAAA"
    @handler.notfound.should == [
      [:block, "2b682a807d39d128cacec6f2d20eef0a4ca3078f303eda7ca9014a446293e23a"]
    ]
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
bitcoin-ruby-0.0.18 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.17 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.16 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.15 spec/bitcoin/protocol/notfound_spec.rb
monacoin-ruby-0.1.3 spec/bitcoin/protocol/notfound_spec.rb
monacoin-ruby-0.1.2 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.14 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.13 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.12 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.11 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.10 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.9 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.8 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.7 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.6 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.5 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.4 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.3 spec/bitcoin/protocol/notfound_spec.rb
bitcoin-ruby-0.0.2 spec/bitcoin/protocol/notfound_spec.rb