Small refactor to update wording.

This commit is contained in:
CalDescent 2021-10-02 15:48:31 +01:00
parent 1b3f37eb78
commit 8eddaa3fac
3 changed files with 9 additions and 9 deletions

View File

@ -49,7 +49,7 @@ public class BootstrapResource {
try (final Repository repository = RepositoryManager.getRepository()) { try (final Repository repository = RepositoryManager.getRepository()) {
Bootstrap bootstrap = new Bootstrap(repository); Bootstrap bootstrap = new Bootstrap(repository);
if (!bootstrap.canBootstrap()) { if (!bootstrap.canCreateBootstrap()) {
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_DATA); throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_DATA);
} }

View File

@ -49,7 +49,7 @@ public class Bootstrap {
* @return true if ready for bootstrap creation, or false if not * @return true if ready for bootstrap creation, or false if not
* All failure reasons are logged * All failure reasons are logged
*/ */
public boolean canBootstrap() { public boolean canCreateBootstrap() {
try { try {
LOGGER.info("Checking repository state..."); LOGGER.info("Checking repository state...");
@ -65,7 +65,7 @@ public class Bootstrap {
// Require that a block archive has been built // Require that a block archive has been built
if (!archiveEnabled) { if (!archiveEnabled) {
LOGGER.info("Unable to bootstrap because the block archive isn't enabled. " + LOGGER.info("Unable to create bootstrap because the block archive isn't enabled. " +
"Set {\"archivedEnabled\": true} in settings.json to fix."); "Set {\"archivedEnabled\": true} in settings.json to fix.");
return false; return false;
} }
@ -73,20 +73,20 @@ public class Bootstrap {
// Make sure that the block archiver is up to date // Make sure that the block archiver is up to date
boolean upToDate = BlockArchiveWriter.isArchiverUpToDate(repository); boolean upToDate = BlockArchiveWriter.isArchiverUpToDate(repository);
if (!upToDate) { if (!upToDate) {
LOGGER.info("Unable to bootstrap because the block archive isn't fully built yet."); LOGGER.info("Unable to create bootstrap because the block archive isn't fully built yet.");
return false; return false;
} }
// Ensure that this database contains the ATStatesHeightIndex which was missing in some cases // Ensure that this database contains the ATStatesHeightIndex which was missing in some cases
boolean hasAtStatesHeightIndex = repository.getATRepository().hasAtStatesHeightIndex(); boolean hasAtStatesHeightIndex = repository.getATRepository().hasAtStatesHeightIndex();
if (!hasAtStatesHeightIndex) { if (!hasAtStatesHeightIndex) {
LOGGER.info("Unable to bootstrap due to missing ATStatesHeightIndex. A re-sync from genesis is needed."); LOGGER.info("Unable to create bootstrap due to missing ATStatesHeightIndex. A re-sync from genesis is needed.");
return false; return false;
} }
// Ensure we have synced NTP time // Ensure we have synced NTP time
if (NTP.getTime() == null) { if (NTP.getTime() == null) {
LOGGER.info("Unable to bootstrap because the node hasn't synced its time yet."); LOGGER.info("Unable to create bootstrap because the node hasn't synced its time yet.");
return false; return false;
} }
@ -94,7 +94,7 @@ public class Bootstrap {
final BlockData chainTip = Controller.getInstance().getChainTip(); final BlockData chainTip = Controller.getInstance().getChainTip();
final Long minLatestBlockTimestamp = Controller.getMinimumLatestBlockTimestamp(); final Long minLatestBlockTimestamp = Controller.getMinimumLatestBlockTimestamp();
if (minLatestBlockTimestamp == null || chainTip.getTimestamp() < minLatestBlockTimestamp) { if (minLatestBlockTimestamp == null || chainTip.getTimestamp() < minLatestBlockTimestamp) {
LOGGER.info("Unable to bootstrap because the blockchain isn't fully synced."); LOGGER.info("Unable to create bootstrap because the blockchain isn't fully synced.");
return false; return false;
} }

View File

@ -42,12 +42,12 @@ public class BootstrapTests extends Common {
} }
@Test @Test
public void testCanBootstrap() throws DataException, InterruptedException, TransformationException, IOException { public void testCanCreateBootstrap() throws DataException, InterruptedException, TransformationException, IOException {
try (final Repository repository = RepositoryManager.getRepository()) { try (final Repository repository = RepositoryManager.getRepository()) {
this.buildDummyBlockchain(repository); this.buildDummyBlockchain(repository);
Bootstrap bootstrap = new Bootstrap(repository); Bootstrap bootstrap = new Bootstrap(repository);
assertTrue(bootstrap.canBootstrap()); assertTrue(bootstrap.canCreateBootstrap());
} }
} }