KeyCrypterScrypt scrypt = new KeyCrypterScrypt(params.realIterations);
// Write the target time to the wallet so we can make the progress bar work when entering the password.
WalletPasswordController.setTargetTime(params.realTargetTime);
// Deriving the actual key runs on a background thread.
KeyDerivationTasks tasks = new KeyDerivationTasks(scrypt, password, params.realTargetTime) {
@Override
protected void onFinish(KeyParameter aesKey) {
// The actual encryption part doesn't take very long as most private keys are derived on demand.
Main.bitcoin.wallet().encrypt(scrypt, aesKey);
informationalAlert("Wallet encrypted",
"You can remove the password at any time from the settings screen.");
overlayUI.done();
}
};
progressMeter.progressProperty().bind(tasks.progress);
tasks.start();
}