mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-16 04:17:25 +00:00
Save-and-load new wallet with extensions in WalletAppKit.
Currently the only guaranteed way of passing the containing wallet to an extension is during deserialization. Therefore every new wallet in WalletAppKit is saved and then loaded before use, to ensure correct initialization of extensions.
This commit is contained in:
@@ -369,7 +369,12 @@ public class WalletAppKit extends AbstractIdleService {
|
||||
for (WalletExtension e : provideWalletExtensions()) {
|
||||
wallet.addExtension(e);
|
||||
}
|
||||
|
||||
// Currently the only way we can be sure that an extension is aware of its containing wallet is by
|
||||
// deserializing the extension (see WalletExtension#deserializeWalletExtension(Wallet, byte[]))
|
||||
// Hence, we first save and then load wallet to ensure any extensions are correctly initialized.
|
||||
wallet.saveToFile(vWalletFile);
|
||||
wallet = loadWallet(false);
|
||||
}
|
||||
|
||||
if (useAutoSave) wallet.autosaveToFile(vWalletFile, 5, TimeUnit.SECONDS, null);
|
||||
|
||||
Reference in New Issue
Block a user