Skip to content

Commit

Permalink
Provide more visiblity into inv bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
aalness committed Apr 15, 2015
1 parent ddfb821 commit 6912320
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/bitcoin/protocol/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def log
#
def parse_inv(payload, type=:put)
count, payload = Protocol.unpack_var_int(payload)
payload.each_byte.each_slice(36){|i|
payload.each_byte.each_slice(36).with_index{|i, idx|
hash = i[4..-1].reverse.pack("C32")
case i[0]
when 1
Expand All @@ -34,7 +34,11 @@ def parse_inv(payload, type=:put)
end
when 2
if type == :put
@h.on_inv_block(hash)
if @h.respond_to?(:on_inv_block_v2)
@h.on_inv_block_v2(hash, idx, count)
else
@h.on_inv_block(hash)
end
else
@h.on_get_block(hash)
end
Expand Down

0 comments on commit 6912320

Please sign in to comment.