Browse Source

Fixed NPE in runIntegrityCheck()

This feature is disabled by default so can be tidied up later. For now, the unhandled scenario is logged and the checking continues on.

One name's transactions are too complex for the current integrity check code to verify (MangoSalsa), but it has been verified manually. All other names pass the automated test.
name-fixes
CalDescent 3 years ago
parent
commit
1b42c5edb1
  1. 7
      src/main/java/org/qortal/controller/repository/NamesDatabaseIntegrityCheck.java

7
src/main/java/org/qortal/controller/repository/NamesDatabaseIntegrityCheck.java

@ -209,7 +209,12 @@ public class NamesDatabaseIntegrityCheck {
newName = registeredName; newName = registeredName;
} }
NameData newNameData = repository.getNameRepository().fromName(newName); NameData newNameData = repository.getNameRepository().fromName(newName);
if (!Objects.equals(creator.getAddress(), newNameData.getOwner())) { if (newNameData == null) {
LOGGER.info("Error: registered name {} has no new name data. This is likely due to account {} " +
"being renamed another time, which is a scenario that is not yet checked automatically.",
updateNameTransactionData.getNewName(), creator.getAddress());
}
else if (!Objects.equals(creator.getAddress(), newNameData.getOwner())) {
LOGGER.info("Error: registered name {} is owned by {}, but it should be {}", LOGGER.info("Error: registered name {} is owned by {}, but it should be {}",
updateNameTransactionData.getNewName(), newNameData.getOwner(), creator.getAddress()); updateNameTransactionData.getNewName(), newNameData.getOwner(), creator.getAddress());
integrityCheckFailed = true; integrityCheckFailed = true;

Loading…
Cancel
Save