Sha256: 0e8e50350766cf88f8047fbc51dca3bf1bba3f06901dfa512623a754f33b687b

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module Bitcoin
  module Protocol

    class Handler
      def on_inv_transaction(hash)
        p ['inv transaction', hth(hash)]
      end

      def on_inv_block(hash)
        p ['inv block', hth(hash)]
      end

      def on_get_transaction(hash)
        p ['get transaction', hth(hash)]
      end

      def on_get_block(hash)
        p ['get block', hth(hash)]
      end

      def on_addr(addr)
        p ['addr', addr, addr.alive?]
      end

      def on_tx(tx)
        p ['tx', tx]
      end

      def on_block(block)
        #p ['block', block]
        puts block.to_json
      end

      def hth(h); h.unpack("H*")[0]; end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitcoin-ruby-0.0.1 lib/bitcoin/protocol/handler.rb