WalletTool: extract common code from dumpWallet() into printWallet()

This commit is contained in:
Sean Gilligan 2022-02-22 11:20:02 -08:00 committed by Andreas Schildbach
parent f411dcd634
commit 0a1e1ca8a0

View file

@ -1255,16 +1255,20 @@ public class WalletTool implements Callable<Integer> {
final KeyParameter aesKey = passwordToKey(true); final KeyParameter aesKey = passwordToKey(true);
if (aesKey == null) if (aesKey == null)
return; // Error message already printed. return; // Error message already printed.
System.out.println(wallet.toString(dumpLookAhead, true, aesKey, true, true, chain)); printWallet( aesKey);
} else { } else {
System.err.println("Can't dump privkeys, wallet is encrypted."); System.err.println("Can't dump privkeys, wallet is encrypted.");
return; return;
} }
} else { } else {
System.out.println(wallet.toString(dumpLookAhead, dumpPrivKeys, null, true, true, chain)); printWallet( null);
} }
} }
private void printWallet(@Nullable KeyParameter aesKey) {
System.out.println(wallet.toString(dumpLookAhead, dumpPrivKeys, aesKey, true, true, chain));
}
private void setCreationTime() { private void setCreationTime() {
long creationTime = getCreationTimeSeconds(); long creationTime = getCreationTimeSeconds();
for (DeterministicKeyChain chain : wallet.getActiveKeyChains()) { for (DeterministicKeyChain chain : wallet.getActiveKeyChains()) {