Sha256: 80e0c9255b90768d32d6828c370535587f277b30131fe2859169d607f43d5c19

Contents?: true

Size: 1.15 KB

Versions: 19

Compression:

Stored size: 1.15 KB

Contents

# encoding: ascii-8bit

require_relative '../spec_helper.rb'

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

  class Getblocks_Handler < Bitcoin::Protocol::Handler
    attr_reader :version, :locator, :stop_hash
    def on_getblocks(version, locator, stop_hash)
      @version, @locator, @stop_hash = version, locator, stop_hash
    end
  end

  before do
    @parser = Bitcoin::Protocol::Parser.new( @handler = Getblocks_Handler.new )
    @pkt = "f9beb4d9676574626c6f636b7300000065000000b3b7ad6e71110100026fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000000000000000000000000000000000000000000000000000000000000000000".htb
    @parser.parse(@pkt + "AAAA").should == "AAAA"
  end

  it 'parses getblocks' do
    @handler.version.should == 70001
    @handler.locator.should == [
      "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
      "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" ]
    @handler.stop_hash.should == "00"*32
  end

  it 'builds getblocks' do
    Bitcoin::Protocol.getblocks_pkt(70001, @handler.locator).hth.should == @pkt.hth
  end

end

Version data entries

19 entries across 19 versions & 2 rubygems

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