mirror of
https://github.com/Qortal/qortal.git
synced 2025-07-27 20:21:22 +00:00
Block chat transactions on the local node if its sender owns a name that is blacklisted by the user.
This commit is contained in:
@@ -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()))
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user