mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 21:47:18 +00:00
WalletAppKit: allow restore from wallet seed even when there are no checkpoints i.e. regtest mode
This commit is contained in:
@@ -255,22 +255,30 @@ 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) {
|
||||||
// Initialize the chain file with a checkpoint to speed up first-run sync.
|
if (checkpoints != null) {
|
||||||
long time;
|
// Initialize the chain file with a checkpoint to speed up first-run sync.
|
||||||
if (restoreFromSeed != null) {
|
long time;
|
||||||
time = restoreFromSeed.getCreationTimeSeconds();
|
if (restoreFromSeed != null) {
|
||||||
if (chainFileExists) {
|
time = restoreFromSeed.getCreationTimeSeconds();
|
||||||
log.info("Deleting the chain file in preparation from restore.");
|
if (chainFileExists) {
|
||||||
vStore.close();
|
log.info("Deleting the chain file in preparation from restore.");
|
||||||
if (!chainFile.delete())
|
vStore.close();
|
||||||
throw new Exception("Failed to delete chain file in preparation for restore.");
|
if (!chainFile.delete())
|
||||||
vStore = new SPVBlockStore(params, chainFile);
|
throw new Exception("Failed to delete chain file in preparation for restore.");
|
||||||
|
vStore = new SPVBlockStore(params, chainFile);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
time = vWallet.getEarliestKeyCreationTime();
|
||||||
}
|
}
|
||||||
} else {
|
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
||||||
time = vWallet.getEarliestKeyCreationTime();
|
} 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);
|
||||||
}
|
}
|
||||||
CheckpointManager.checkpoint(params, checkpoints, vStore, time);
|
|
||||||
}
|
}
|
||||||
vChain = new BlockChain(params, vStore);
|
vChain = new BlockChain(params, vStore);
|
||||||
vPeerGroup = createPeerGroup();
|
vPeerGroup = createPeerGroup();
|
||||||
|
|||||||
Reference in New Issue
Block a user