forked from Qortal/qortal
Add initial peers on node startup if we don't have any in the repository.
This will be needed for future bootstraps, which don't contain any peers. It is also useful for those who have used the DELETE /peers/known API.
This commit is contained in:
parent
a1e4047695
commit
f53e2ffa47
@ -457,6 +457,9 @@ public class Controller extends Thread {
|
||||
// Import current trade bot states and minting accounts if they exist
|
||||
Controller.importRepositoryData();
|
||||
|
||||
// Add the initial peers to the repository if we don't have any
|
||||
Controller.installInitialPeers();
|
||||
|
||||
LOGGER.info("Starting controller");
|
||||
Controller.getInstance().start();
|
||||
|
||||
@ -679,6 +682,17 @@ public class Controller extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
private static void installInitialPeers() {
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
if (repository.getNetworkRepository().getAllPeers().isEmpty()) {
|
||||
Network.installInitialPeers(repository);
|
||||
}
|
||||
|
||||
} catch (DataException e) {
|
||||
// Fail silently as this is an optional step
|
||||
}
|
||||
}
|
||||
|
||||
private long getRandomRepositoryMaintenanceInterval() {
|
||||
final long minInterval = Settings.getInstance().getRepositoryMaintenanceMinInterval();
|
||||
final long maxInterval = Settings.getInstance().getRepositoryMaintenanceMaxInterval();
|
||||
|
Loading…
x
Reference in New Issue
Block a user