lib/bitcoin/protocol/handler.rb in bitcoin-ruby-0.0.1 vs lib/bitcoin/protocol/handler.rb in bitcoin-ruby-0.0.2
- old
+ new
@@ -1,23 +1,25 @@
+# encoding: ascii-8bit
+
module Bitcoin
module Protocol
class Handler
def on_inv_transaction(hash)
- p ['inv transaction', hth(hash)]
+ p ['inv transaction', hash.hth]
end
def on_inv_block(hash)
- p ['inv block', hth(hash)]
+ p ['inv block', hash.hth]
end
def on_get_transaction(hash)
- p ['get transaction', hth(hash)]
+ p ['get transaction', hash.hth]
end
def on_get_block(hash)
- p ['get block', hth(hash)]
+ p ['get block', hash.hth]
end
def on_addr(addr)
p ['addr', addr, addr.alive?]
end
@@ -29,10 +31,9 @@
def on_block(block)
#p ['block', block]
puts block.to_json
end
- def hth(h); h.unpack("H*")[0]; end
end
end
end