mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 14:50:57 +01: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:
parent
049baad8c6
commit
2e895e4e09
1 changed files with 4 additions and 2 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue