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);

View File

@ -182,10 +182,12 @@ INVALID_TIMESTAMP_SIGNATURE = invalid timestamp signature
ADDRESS_IN_BLACKLIST = this address is in your blacklist
NAME_IN_BLACKLIST = this name is in your blacklist
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit
DUPLICATE_MESSAGE = address sent duplicate message
INVALID_BUT_OK = invalid but OK
NOT_YET_RELEASED = feature not yet released
NOT_YET_RELEASED = feature not yet released

View File

@ -182,10 +182,12 @@ TX_GROUP_ID_MISMATCH = transaktion ryhmä-ID:n vastaavuusvirhe
ADDRESS_IN_BLACKLIST = this address is in your blacklist
NAME_IN_BLACKLIST = this name is in your blacklist
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit
DUPLICATE_MESSAGE = address sent duplicate message
INVALID_TIMESTAMP_SIGNATURE = Invalid timestamp signature
INVALID_BUT_OK = Invalid but OK
INVALID_BUT_OK = Invalid but OK

View File

@ -184,10 +184,12 @@ INVALID_TIMESTAMP_SIGNATURE = érvénytelen időbélyeg aláírás
ADDRESS_IN_BLACKLIST = ez a fiókcím a fekete listádon van
NAME_IN_BLACKLIST = this name is in your blacklist
ADDRESS_ABOVE_RATE_LIMIT = ez a cím elérte a megengedett mérték korlátot
DUPLICATE_MESSAGE = ez a cím duplikált üzenetet küldött
INVALID_BUT_OK = érvénytelen de elfogadva
NOT_YET_RELEASED = ez a funkció még nem került kiadásra
NOT_YET_RELEASED = ez a funkció még nem került kiadásra

View File

@ -184,10 +184,12 @@ TX_GROUP_ID_MISMATCH = identificazione di gruppo della transazione non corrispon
ADDRESS_IN_BLACKLIST = this address is in your blacklist
NAME_IN_BLACKLIST = this name is in your blacklist
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit
DUPLICATE_MESSAGE = address sent duplicate message
INVALID_TIMESTAMP_SIGNATURE = Invalid timestamp signature
INVALID_BUT_OK = Invalid but OK
INVALID_BUT_OK = Invalid but OK

View File

@ -182,10 +182,12 @@ TX_GROUP_ID_MISMATCH = groep-ID van transactie matcht niet
ADDRESS_IN_BLACKLIST = this address is in your blacklist
NAME_IN_BLACKLIST = this name is in your blacklist
ADDRESS_ABOVE_RATE_LIMIT = address reached specified rate limit
DUPLICATE_MESSAGE = address sent duplicate message
INVALID_TIMESTAMP_SIGNATURE = Invalid timestamp signature
INVALID_BUT_OK = Invalid but OK
INVALID_BUT_OK = Invalid but OK