Take a backup of local data before overwriting with a bootstrap.

Also moved the import phase to after the validation phase, so that the data returns after the bootstrap.
This commit is contained in:
CalDescent 2021-10-03 16:09:40 +01:00
parent dc876d9c96
commit 52b322b756
2 changed files with 5 additions and 4 deletions

View File

@ -515,6 +515,7 @@ public class BlockChain {
if (!isTopOnly && archiveEnabled && canBootstrap) {
needsArchiveRebuild = (repository.getBlockArchiveRepository().fromHeight(2) == null);
LOGGER.info("Couldn't retrieve block 2 from archive. Bootstrapping...");
Controller.getInstance().exportRepositoryData();
}
}

View File

@ -436,9 +436,6 @@ public class Controller extends Thread {
return; // Not System.exit() so that GUI can display error
}
// Import current trade bot states and minting accounts if they exist
Controller.importRepositoryData();
// Rebuild Names table and check database integrity
NamesDatabaseIntegrityCheck namesDatabaseIntegrityCheck = new NamesDatabaseIntegrityCheck();
namesDatabaseIntegrityCheck.rebuildAllNames();
@ -456,6 +453,9 @@ public class Controller extends Thread {
return; // Not System.exit() so that GUI can display error
}
// Import current trade bot states and minting accounts if they exist
Controller.importRepositoryData();
LOGGER.info("Starting controller");
Controller.getInstance().start();
@ -655,7 +655,7 @@ public class Controller extends Thread {
/**
* Export current trade bot states and minting accounts.
*/
private void exportRepositoryData() {
public void exportRepositoryData() {
try (final Repository repository = RepositoryManager.getRepository()) {
repository.exportNodeLocalData();