From cc65a7cd11a4ddc4b9e7df02d5d07f554fa10e33 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Tue, 14 Sep 2021 20:38:20 +0100 Subject: [PATCH] Fixed bug which prevented the "reduced name" from being updated in UPDATE_NAME transactions. Updating a name was incorrectly leaving the existing "reduced name" intact. Thanks to Qortal user @MyBestBet for reporting this bug. --- src/main/java/org/qortal/naming/Name.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/qortal/naming/Name.java b/src/main/java/org/qortal/naming/Name.java index c372a8e3..454ade57 100644 --- a/src/main/java/org/qortal/naming/Name.java +++ b/src/main/java/org/qortal/naming/Name.java @@ -78,9 +78,10 @@ public class Name { // Set name's last-updated timestamp this.nameData.setUpdated(updateNameTransactionData.getTimestamp()); - // Update name and data where appropriate + // Update name, reduced name, and data where appropriate if (!updateNameTransactionData.getNewName().isEmpty()) { this.nameData.setName(updateNameTransactionData.getNewName()); + this.nameData.setReducedName(updateNameTransactionData.getReducedNewName()); // If we're changing the name, we need to delete old entry this.repository.getNameRepository().delete(updateNameTransactionData.getName()); @@ -106,6 +107,9 @@ public class Name { // We can find previous 'name' from update transaction this.nameData.setName(updateNameTransactionData.getName()); + // We can derive the previous 'reduced name' from the previous name + this.nameData.setReducedName(Unicode.sanitize(updateNameTransactionData.getName())); + // We might need to hunt for previous data value if (!updateNameTransactionData.getNewData().isEmpty()) this.nameData.setData(findPreviousData(nameReference));