Class: Bitcoin::Protocol::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin/protocol/handler.rb

Overview

Instance Method Summary collapse

Instance Method Details

#on_addr(addr) ⇒ Object



23
24
25
# File 'lib/bitcoin/protocol/handler.rb', line 23

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

#on_block(block) ⇒ Object



31
32
33
34
# File 'lib/bitcoin/protocol/handler.rb', line 31

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

#on_error(message, payload) ⇒ Object



36
37
38
# File 'lib/bitcoin/protocol/handler.rb', line 36

def on_error(message, payload)
  p ['error', message, payload]
end

#on_get_block(hash) ⇒ Object



19
20
21
# File 'lib/bitcoin/protocol/handler.rb', line 19

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

#on_get_transaction(hash) ⇒ Object



15
16
17
# File 'lib/bitcoin/protocol/handler.rb', line 15

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

#on_inv_block(hash) ⇒ Object



11
12
13
# File 'lib/bitcoin/protocol/handler.rb', line 11

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

#on_inv_transaction(hash) ⇒ Object



7
8
9
# File 'lib/bitcoin/protocol/handler.rb', line 7

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

#on_tx(tx) ⇒ Object



27
28
29
# File 'lib/bitcoin/protocol/handler.rb', line 27

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