Peer: Wrap log.debug() in log.isDebugEnabled().
@@ -574,6 +574,7 @@ public class Peer extends PeerSocketHandler {
// Now it's our turn ...
// Send an ACK message stating we accept the peers protocol version.
sendMessage(new VersionAck());
+ if (log.isDebugEnabled())
log.debug("{}: Incoming version handshake complete.", this);
incomingVersionHandshakeFuture.set(this);
}
@@ -585,11 +586,13 @@ public class Peer extends PeerSocketHandler {
if (outgoingVersionHandshakeFuture.isDone()) {
throw new ProtocolException("got more than one version ack");
}
+ if (log.isDebugEnabled())
log.debug("{}: Outgoing version handshake complete.", this);
outgoingVersionHandshakeFuture.set(this);
}
private void versionHandshakeComplete() {
+ if (log.isDebugEnabled())
log.debug("{}: Handshake complete.", this);
setTimeoutEnabled(false);
for (final ListenerRegistration<PeerConnectedEventListener> registration : connectedEventListeners) {
@@ -639,9 +642,10 @@ public class Peer extends PeerSocketHandler {
protected void processAlert(AlertMessage m) {
try {
- if (m.isSignatureValid()) {
+ if (log.isDebugEnabled()) {
+ if (m.isSignatureValid())
log.debug("Received alert from peer {}: {}", this, m.getStatusBar());
- } else {
+ else
log.debug("Received alert with invalid signature from peer {}: {}", this, m.getStatusBar());
}
} catch (Throwable t) {
@@ -757,6 +761,7 @@ public class Peer extends PeerSocketHandler {
tx.verify();
lock.lock();
try {
+ if (log.isDebugEnabled())
log.debug("{}: Received tx {}", getAddress(), tx.getTxId());
// Label the transaction as coming in from the P2P network (as opposed to being created by us, direct import,
// etc). This helps the wallet decide how to risk analyze it later.
@@ -966,17 +971,18 @@ public class Peer extends PeerSocketHandler {
}
protected void processBlock(Block m) {
- if (log.isDebugEnabled()) {
+ if (log.isDebugEnabled())
log.debug("{}: Received broadcast block {}", getAddress(), m.getHashAsString());
- }
// Was this block requested by getBlock()?
if (maybeHandleRequestedData(m)) return;
if (blockChain == null) {
+ if (log.isDebugEnabled())
log.debug("Received block but was not configured with an AbstractBlockChain");
return;
}
// Did we lose download peer status after requesting block data?
if (!vDownloadData) {
+ if (log.isDebugEnabled())
log.debug("{}: Received block we did not ask for: {}", getAddress(), m.getHashAsString());
return;
}
@@ -1031,10 +1037,12 @@ public class Peer extends PeerSocketHandler {
if (log.isDebugEnabled())
log.debug("{}: Received broadcast filtered block {}", getAddress(), m.getHash().toString());
if (!vDownloadData) {
+ if (log.isDebugEnabled())
log.debug("{}: Received block we did not ask for: {}", getAddress(), m.getHash().toString());
return;
}
if (blockChain == null) {
+ if (log.isDebugEnabled())
log.debug("Received filtered block but was not configured with an AbstractBlockChain");
return;
}
@@ -1219,6 +1227,7 @@ public class Peer extends PeerSocketHandler {
// We created this transaction ourselves, so don't download.
it.remove();
} else {
+ if (log.isDebugEnabled())
log.debug("{}: getdata on tx {}", getAddress(), item.hash);
getdata.addTransaction(item.hash, vPeerVersionMessage.isWitnessSupported());
if (pendingTxDownloads.size() > PENDING_TX_DOWNLOADS_LIMIT) {
@@ -1525,6 +1534,7 @@ public class Peer extends PeerSocketHandler {
if (!future.isDone()) {
long elapsed = Utils.currentTimeMillis() - startTimeMsec;
Peer.this.addPingTimeData(elapsed);
+ if (log.isDebugEnabled())
log.debug("{}: ping time is {} ms", Peer.this.toString(), elapsed);
future.set(elapsed);
}
