mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-22 20:26:50 +00:00
Added test for bootstrap random host selection.
This commit is contained in:
@@ -368,10 +368,7 @@ public class Bootstrap {
|
||||
}
|
||||
|
||||
private void downloadToPath(Path path) throws DataException {
|
||||
// Select a random host from bootstrapHosts
|
||||
String[] hosts = Settings.getInstance().getBootstrapHosts();
|
||||
int index = new SecureRandom().nextInt(hosts.length);
|
||||
String bootstrapHost = hosts[index];
|
||||
String bootstrapHost = this.getRandomHost();
|
||||
String bootstrapFilename = this.getFilename();
|
||||
String bootstrapUrl = String.format("%s/%s", bootstrapHost, bootstrapFilename);
|
||||
|
||||
@@ -420,6 +417,14 @@ public class Bootstrap {
|
||||
}
|
||||
}
|
||||
|
||||
public String getRandomHost() {
|
||||
// Select a random host from bootstrapHosts
|
||||
String[] hosts = Settings.getInstance().getBootstrapHosts();
|
||||
int index = new SecureRandom().nextInt(hosts.length);
|
||||
String bootstrapHost = hosts[index];
|
||||
return bootstrapHost;
|
||||
}
|
||||
|
||||
public void importFromPath(Path path) throws InterruptedException, DataException, IOException {
|
||||
|
||||
ReentrantLock blockchainLock = Controller.getInstance().getBlockchainLock();
|
||||
|
Reference in New Issue
Block a user