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,18 +40,22 @@ public class BlockImporter {
params = MainNetParams.get(); params = MainNetParams.get();
BlockStore store; BlockStore store;
if (args[1].equals("MemFull")) { switch (args[1]) {
Preconditions.checkArgument(args.length == 2); case "MemFull":
store = new MemoryFullPrunedBlockStore(params, 100); Preconditions.checkArgument(args.length == 2);
} else if (args[1].equals("Mem")) { store = new MemoryFullPrunedBlockStore(params, 100);
Preconditions.checkArgument(args.length == 2); break;
store = new MemoryBlockStore(params); case "Mem":
} else if (args[1].equals("SPV")) { Preconditions.checkArgument(args.length == 2);
Preconditions.checkArgument(args.length == 3); store = new MemoryBlockStore(params);
store = new SPVBlockStore(params, new File(args[2])); break;
} else { case "SPV":
System.err.println("Unknown store " + args[1]); Preconditions.checkArgument(args.length == 3);
return; store = new SPVBlockStore(params, new File(args[2]));
break;
default:
System.err.println("Unknown store " + args[1]);
return;
} }
AbstractBlockChain chain = null; AbstractBlockChain chain = null;