mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 13:22:42 +01:00
WalletTool: new option for setting the type of filter for syncing
Currently, only server-side (bloom) filtering is supported.
This commit is contained in:
parent
c210fe7ba2
commit
02ef9d50c3
@ -187,6 +187,8 @@ public class WalletTool implements Callable<Integer> {
|
||||
"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<Integer> {
|
||||
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<Integer> {
|
||||
peerGroup.setMaxConnections(1);
|
||||
}
|
||||
peerGroup.addWallet(wallet);
|
||||
peerGroup.setBloomFilteringEnabled(filter == Filter.SERVER);
|
||||
if (peersStr != null) {
|
||||
String[] peerAddrs = peersStr.split(",");
|
||||
for (String peer : peerAddrs) {
|
||||
|
Loading…
Reference in New Issue
Block a user