Commit 17d7c2a9c15441ad46a3467162610361383bc092

Authored by Marius Hanne
1 parent e3b9dea421

adjust network log levels

Showing 1 changed file with 11 additions and 11 deletions Side-by-side Diff

lib/bitcoin/network/connection_handler.rb
... ... @@ -51,7 +51,7 @@
51 51  
52 52 # receive data from peer and invoke Protocol::Parser
53 53 def receive_data data
54   - log.debug { "Receiving data (#{data.size} bytes)" }
  54 + #log.debug { "Receiving data (#{data.size} bytes)" }
55 55 @parser.parse(data)
56 56 end
57 57  
... ... @@ -66,7 +66,7 @@
66 66 # received +inv_tx+ message for given +hash+.
67 67 # add to inv_queue, unlesss maximum is reached
68 68 def on_inv_transaction(hash)
69   - log.info { ">> inv transaction: #{hth(hash)}" }
  69 + log.debug { ">> inv transaction: #{hth(hash)}" }
70 70 return if @node.inv_queue.size >= @node.config[:max][:inv]
71 71 @node.queue_inv([:tx, hash, self])
72 72 end
... ... @@ -74,7 +74,7 @@
74 74 # received +inv_block+ message for given +hash+.
75 75 # add to inv_queue, unless maximum is reached
76 76 def on_inv_block(hash)
77   - log.info { ">> inv block: #{hth(hash)}" }
  77 + log.debug { ">> inv block: #{hth(hash)}" }
78 78 return if @node.inv_queue.size >= @node.config[:max][:inv]
79 79 @node.queue_inv([:block, hash, self])
80 80 end
81 81  
... ... @@ -82,11 +82,11 @@
82 82 # received +get_tx+ message for given +hash+.
83 83 # send specified tx if we have it
84 84 def on_get_transaction(hash)
85   - log.info { ">> get transaction: #{hash.unpack("H*")[0]}" }
  85 + log.debug { ">> get transaction: #{hash.unpack("H*")[0]}" }
86 86 tx = @node.store.get_tx(hash.unpack("H*")[0])
87 87 return unless tx
88 88 pkt = Bitcoin::Protocol.pkt("tx", tx.to_payload)
89   - log.info { "<< tx: #{tx.hash}" }
  89 + log.debug { "<< tx: #{tx.hash}" }
90 90 send_data pkt
91 91 end
92 92  
93 93  
94 94  
... ... @@ -94,20 +94,20 @@
94 94 # send specified block if we have it
95 95 # TODO
96 96 def on_get_block(hash)
97   - log.info { ">> get block: #{hth(hash)}" }
  97 + log.debug { ">> get block: #{hth(hash)}" }
98 98 end
99 99  
100 100 # send +inv+ message with given +type+ for given +obj+
101 101 def send_inv type, obj
102 102 pkt = Protocol.inv_pkt(type, [[obj.hash].pack("H*")])
103   - log.info { "<< inv #{type}: #{obj.hash}" }
  103 + log.debug { "<< inv #{type}: #{obj.hash}" }
104 104 send_data(pkt)
105 105 end
106 106  
107 107 # received +addr+ message for given +addr+.
108 108 # store addr in node and notify listeners
109 109 def on_addr(addr)
110   - log.info { ">> addr: #{addr.ip}:#{addr.port} alive: #{addr.alive?}, service: #{addr.service}" }
  110 + log.debug { ">> addr: #{addr.ip}:#{addr.port} alive: #{addr.alive?}, service: #{addr.service}" }
111 111 @node.addrs << addr
112 112 @node.notifiers[:addr].push(addr)
113 113 end
... ... @@ -129,7 +129,7 @@
129 129 # received +headers+ message for given +headers+.
130 130 # push each header to storage queue
131 131 def on_headers(headers)
132   - log.info { ">> headers: #{headers.size}" }
  132 + log.info { ">> headers (#{headers.size})" }
133 133 headers.each {|h| @node.queue.push([:block, h])}
134 134 end
135 135  
136 136  
... ... @@ -186,13 +186,13 @@
186 186 locator = @node.store.get_locator
187 187 pkt = Protocol.pkt("getheaders", [Bitcoin::network[:magic_head],
188 188 locator.size.chr, *locator.map{|l| htb(l).reverse}, "\x00"*32].join)
189   - log.info { "<< getheaders: #{locator.first}" }
  189 + log.debug { "<< getheaders: #{locator.first}" }
190 190 send_data(pkt)
191 191 end
192 192  
193 193 # send +getaddr+ message
194 194 def send_getaddr
195   - log.info { "<< getaddr" }
  195 + log.debug { "<< getaddr" }
196 196 send_data(Protocol.pkt("getaddr", ""))
197 197 end
198 198