From f4033076e80dd2c8327ce263d12e6c7c9469c997 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Tue, 19 Feb 2013 14:43:50 +0100 Subject: [PATCH] Don't build/send Bloom filters when there are no keys in any wallets. Resolves issue 324. --- core/src/main/java/com/google/bitcoin/core/PeerGroup.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/google/bitcoin/core/PeerGroup.java b/core/src/main/java/com/google/bitcoin/core/PeerGroup.java index 58e9d686..fc67cea8 100644 --- a/core/src/main/java/com/google/bitcoin/core/PeerGroup.java +++ b/core/src/main/java/com/google/bitcoin/core/PeerGroup.java @@ -570,7 +570,7 @@ public class PeerGroup extends AbstractIdleService { elements += w.getBloomFilterElementCount(); } - if (chain == null || !chain.shouldVerifyTransactions()) { + if (chain == null || !chain.shouldVerifyTransactions() && elements > 0) { // We stair-step our element count so that we avoid creating a filter with different parameters // as much as possible as that results in a loss of privacy. // The constant 100 here is somewhat arbitrary, but makes sense for small to medium wallets - @@ -587,7 +587,7 @@ public class PeerGroup extends AbstractIdleService { peer.sendMessage(filter); } catch (IOException e) { } } - //Do this last so that bloomFilter is already set when it gets called + // Do this last so that bloomFilter is already set when it gets called. setFastCatchupTimeSecs(earliestKeyTime); }