BlockImporter: use switch statement for store argument

This commit is contained in:
Sean Gilligan 2023-02-10 19:49:09 -08:00 committed by Andreas Schildbach
parent e6a4dd4718
commit 0d6da641d8

View file

@ -40,16 +40,20 @@ public class BlockImporter {
params = MainNetParams.get(); params = MainNetParams.get();
BlockStore store; BlockStore store;
if (args[1].equals("MemFull")) { switch (args[1]) {
case "MemFull":
Preconditions.checkArgument(args.length == 2); Preconditions.checkArgument(args.length == 2);
store = new MemoryFullPrunedBlockStore(params, 100); store = new MemoryFullPrunedBlockStore(params, 100);
} else if (args[1].equals("Mem")) { break;
case "Mem":
Preconditions.checkArgument(args.length == 2); Preconditions.checkArgument(args.length == 2);
store = new MemoryBlockStore(params); store = new MemoryBlockStore(params);
} else if (args[1].equals("SPV")) { break;
case "SPV":
Preconditions.checkArgument(args.length == 3); Preconditions.checkArgument(args.length == 3);
store = new SPVBlockStore(params, new File(args[2])); store = new SPVBlockStore(params, new File(args[2]));
} else { break;
default:
System.err.println("Unknown store " + args[1]); System.err.println("Unknown store " + args[1]);
return; return;
} }