Skip to content

Commit

Permalink
Merge bitcoin#10124: [test] Suppress test logging spam
Browse files Browse the repository at this point in the history
45ce471 Reduce spammy test logging (John Newbery)

Tree-SHA512: 64b2ce29fb62a4e738840bbaf93563559451c2ef078ba66ecfc1dbe34adefea61ad2ad2d768444cb2e0b30cb3cbe47e38ed818d4c91f7723a3d1ba9fdd0043f9
  • Loading branch information
MarcoFalke authored and PastaPastaPasta committed May 20, 2019
1 parent 5e41474 commit ecd3ad4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions test/functional/test_framework/mininode.py
Expand Up @@ -1882,7 +1882,7 @@ def got_data(self):
def send_message(self, message, pushbuf=False):
if self.state != "connected" and not pushbuf:
raise IOError('Not connected, no pushbuf')
logger.debug("Send message to %s:%d: %s" % (self.dstaddr, self.dstport, repr(message)))
self._log_message("send", message)
command = message.command
data = message.serialize()
tmsg = self.MAGIC_BYTES[self.network]
Expand All @@ -1904,9 +1904,19 @@ def got_message(self, message):
self.messagemap[b'ping'] = msg_ping_prebip31
if self.last_sent + 30 * 60 < time.time():
self.send_message(self.messagemap[b'ping']())
logger.debug("Received message from %s:%d: %s" % (self.dstaddr, self.dstport, repr(message)))
self._log_message("receive", message)
self.cb.deliver(self, message)

def _log_message(self, direction, msg):
if direction == "send":
log_message = "Send message to "
elif direction == "receive":
log_message = "Received message from "
log_message += "%s:%d: %s" % (self.dstaddr, self.dstport, repr(msg)[:500])
if len(log_message) > 500:
log_message += "... (msg truncated)"
logger.debug(log_message)

def disconnect_node(self):
self.disconnect = True

Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_framework/util.py
Expand Up @@ -343,7 +343,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
if binary is None:
binary = os.getenv("BITCOIND", "dashd")
# RPC tests still depend on free transactions
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-blockprioritysize=50000", "-logtimemicros", "-debug", "-mocktime="+str(get_mocktime()) ]
args = [binary, "-datadir=" + datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-blockprioritysize=50000", "-logtimemicros", "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(get_mocktime())]
# Don't try auto backups (they fail a lot when running tests)
args += [ "-createwalletbackups=0" ]
if extra_args is not None: args.extend(extra_args)
Expand Down

0 comments on commit ecd3ad4

Please sign in to comment.