diff --git a/wallettool/src/main/java/org/bitcoinj/wallettool/WalletTool.java b/wallettool/src/main/java/org/bitcoinj/wallettool/WalletTool.java index 303489cb2..3a69e28bf 100644 --- a/wallettool/src/main/java/org/bitcoinj/wallettool/WalletTool.java +++ b/wallettool/src/main/java/org/bitcoinj/wallettool/WalletTool.java @@ -187,6 +187,8 @@ public class WalletTool implements Callable { "BLOCK A new block that builds on the best chain.%n" + "BALANCE Waits until the wallets balance meets the --condition.") private WaitForEnum waitFor = null; + @CommandLine.Option(names = "--filter", description = "Use filter when synching the chain. Valid values: ${COMPLETION-CANDIDATES}. Default: ${DEFAULT-VALUE}") + private Filter filter = Filter.SERVER; @CommandLine.Option(names = "--chain", description = "Specifies the name of the file that stores the block chain.") private File chainFile = null; @CommandLine.Option(names = "--pubkey", description = "Specifies a hex/base58 encoded non-compressed public key.") @@ -323,6 +325,11 @@ public class WalletTool implements Callable { BALANCE } + public enum Filter { + NONE, + SERVER, // bloom filter + } + public static void main(String[] args) { int exitCode = new CommandLine(new WalletTool()).execute(args); System.exit(exitCode); @@ -987,6 +994,7 @@ public class WalletTool implements Callable { peerGroup.setMaxConnections(1); } peerGroup.addWallet(wallet); + peerGroup.setBloomFilteringEnabled(filter == Filter.SERVER); if (peersStr != null) { String[] peerAddrs = peersStr.split(","); for (String peer : peerAddrs) {