3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 23:32:16 +00:00

Optimization when downloading blocks (should be rare these days), don't format log messages that requires an expensive hash->string conversion if the debug channel is not enabled.

This commit is contained in:
Mike Hearn 2013-02-27 15:18:04 +01:00
parent 049baad8c6
commit 2e895e4e09

View File

@ -640,7 +640,8 @@ public class Peer {
}
private synchronized void processBlock(Block m) throws IOException {
log.debug("{}: Received broadcast block {}", address.get(), m.getHashAsString());
if (log.isDebugEnabled())
log.debug("{}: Received broadcast block {}", address.get(), m.getHashAsString());
try {
// Was this block requested by getBlock()?
if (maybeHandleRequestedData(m)) return;
@ -691,7 +692,8 @@ public class Peer {
// TODO: Fix this duplication.
private synchronized void processFilteredBlock(FilteredBlock m) throws IOException {
log.debug("{}: Received broadcast filtered block {}", address.get(), m.getHash().toString());
if (log.isDebugEnabled())
log.debug("{}: Received broadcast filtered block {}", address.get(), m.getHash().toString());
try {
if (!downloadData.get()) {
log.debug("{}: Received block we did not ask for: {}", address.get(), m.getHash().toString());