Merge remote-tracking branch 'qortal/master'

This commit is contained in:
CalDescent
2021-12-21 15:42:52 +00:00
8 changed files with 269 additions and 7 deletions

View File

@@ -422,10 +422,12 @@ public class Controller extends Thread {
return; // Not System.exit() so that GUI can display error
}
// Rebuild Names table and check database integrity
// Rebuild Names table and check database integrity (if enabled)
NamesDatabaseIntegrityCheck namesDatabaseIntegrityCheck = new NamesDatabaseIntegrityCheck();
namesDatabaseIntegrityCheck.rebuildAllNames();
namesDatabaseIntegrityCheck.runIntegrityCheck();
if (Settings.getInstance().isNamesIntegrityCheckEnabled()) {
namesDatabaseIntegrityCheck.runIntegrityCheck();
}
LOGGER.info("Validating blockchain");
try {

View File

@@ -187,7 +187,12 @@ public class NamesDatabaseIntegrityCheck {
// The old name will then be unregistered, or re-registered.
// FUTURE: check database integrity for names that have been updated and then the original name re-registered
else if (Objects.equals(updateNameTransactionData.getName(), registeredName)) {
NameData newNameData = repository.getNameRepository().fromName(updateNameTransactionData.getNewName());
String newName = updateNameTransactionData.getNewName();
if (newName == null || newName.length() == 0) {
// If new name is blank (or maybe null, just to be safe), it means that it stayed the same
newName = registeredName;
}
NameData newNameData = repository.getNameRepository().fromName(newName);
if (!Objects.equals(creator.getAddress(), newNameData.getOwner())) {
LOGGER.info("Error: registered name {} is owned by {}, but it should be {}",
updateNameTransactionData.getNewName(), newNameData.getOwner(), creator.getAddress());

View File

@@ -173,6 +173,10 @@ public class Settings {
private boolean bootstrap = true;
/** Registered names integrity check */
private boolean namesIntegrityCheckEnabled = false;
// Peer-to-peer related
private boolean isTestNet = false;
/** Port number for inbound peer-to-peer connections. */
@@ -805,6 +809,10 @@ public class Settings {
return this.blockPruneBatchSize;
}
public boolean isNamesIntegrityCheckEnabled() {
return this.namesIntegrityCheckEnabled;
}
public boolean isArchiveEnabled() {
if (this.topOnly) {