Block chat transactions on the local node if its sender owns a name that is blacklisted by the user.

This commit is contained in:
CalDescent
2021-11-13 11:12:52 +00:00
parent bfffff0750
commit 0d69797851
7 changed files with 29 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import org.qortal.account.PublicKeyAccount;
import org.qortal.asset.Asset;
import org.qortal.crypto.Crypto;
import org.qortal.crypto.MemoryPoW;
import org.qortal.data.naming.NameData;
import org.qortal.data.transaction.ChatTransactionData;
import org.qortal.data.transaction.TransactionData;
import org.qortal.group.Group;
@@ -150,6 +151,18 @@ public class ChatTransaction extends Transaction {
return ValidationResult.ADDRESS_IN_BLACKLIST;
}
// Check for blacklisted author by registered name
List<NameData> names = this.repository.getNameRepository().getNamesByOwner(this.chatTransactionData.getSender());
if (names != null && names.size() > 0) {
for (NameData nameData : names) {
if (nameData != null && nameData.getName() != null) {
if (listManager.listContains("blacklist", "names", nameData.getName())) {
return ValidationResult.NAME_IN_BLACKLIST;
}
}
}
}
// If we exist in the repository then we've been imported as unconfirmed,
// but we don't want to make it into a block, so return fake non-OK result.
if (this.repository.getTransactionRepository().exists(this.chatTransactionData.getSignature()))

View File

@@ -248,6 +248,7 @@ public abstract class Transaction {
INCORRECT_NONCE(94),
INVALID_TIMESTAMP_SIGNATURE(95),
ADDRESS_IN_BLACKLIST(96),
NAME_IN_BLACKLIST(97),
INVALID_BUT_OK(999),
NOT_YET_RELEASED(1000);