mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-01 12:31:23 +00:00
WalletAppKit: allow restore from wallet seed even when there are no checkpoints i.e. regtest mode
This commit is contained in:
@@ -255,7 +255,8 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
|
|
||||||
// Initiate Bitcoin network objects (block store, blockchain and peer group)
|
// Initiate Bitcoin network objects (block store, blockchain and peer group)
|
||||||
vStore = new SPVBlockStore(params, chainFile);
|
vStore = new SPVBlockStore(params, chainFile);
|
||||||
if ((!chainFileExists || restoreFromSeed != null) && checkpoints != null) {
|
if (!chainFileExists || restoreFromSeed != null) {
|
||||||
|
if (checkpoints != null) {
|
||||||
// Initialize the chain file with a checkpoint to speed up first-run sync.
|
// Initialize the chain file with a checkpoint to speed up first-run sync.
|
||||||
long time;
|
long time;
|
||||||
if (restoreFromSeed != null) {
|
if (restoreFromSeed != null) {
|
||||||
@@ -271,6 +272,13 @@ public class WalletAppKit extends AbstractIdleService {
|
|||||||
time = vWallet.getEarliestKeyCreationTime();
|
time = vWallet.getEarliestKeyCreationTime();
|
||||||
}
|
}
|
||||||
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
||||||
|
} else if (chainFileExists) {
|
||||||
|
log.info("Deleting the chain file in preparation from restore.");
|
||||||
|
vStore.close();
|
||||||
|
if (!chainFile.delete())
|
||||||
|
throw new Exception("Failed to delete chain file in preparation for restore.");
|
||||||
|
vStore = new SPVBlockStore(params, chainFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
vChain = new BlockChain(params, vStore);
|
vChain = new BlockChain(params, vStore);
|
||||||
vPeerGroup = createPeerGroup();
|
vPeerGroup = createPeerGroup();
|
||||||
|
Reference in New Issue
Block a user