Disallow CHAT transactions with timestamps more than 5 minutes in the future.

This commit is contained in:
CalDescent 2022-12-14 16:40:57 +00:00
parent 99d5bf9103
commit 08de1fb4ec

View File

@ -19,6 +19,7 @@ import org.qortal.repository.Repository;
import org.qortal.transform.TransformationException; import org.qortal.transform.TransformationException;
import org.qortal.transform.transaction.ChatTransactionTransformer; import org.qortal.transform.transaction.ChatTransactionTransformer;
import org.qortal.transform.transaction.TransactionTransformer; import org.qortal.transform.transaction.TransactionTransformer;
import org.qortal.utils.NTP;
public class ChatTransaction extends Transaction { public class ChatTransaction extends Transaction {
@ -145,6 +146,11 @@ public class ChatTransaction extends Transaction {
public ValidationResult isValid() throws DataException { public ValidationResult isValid() throws DataException {
// Nonce checking is done via isSignatureValid() as that method is only called once per import // Nonce checking is done via isSignatureValid() as that method is only called once per import
// Disregard messages with timestamp too far in the future (we have stricter limits for CHAT transactions)
if (this.chatTransactionData.getTimestamp() > NTP.getTime() + (5 * 60 * 1000L)) {
return ValidationResult.TIMESTAMP_TOO_NEW;
}
// Check for blocked author by address // Check for blocked author by address
ResourceListManager listManager = ResourceListManager.getInstance(); ResourceListManager listManager = ResourceListManager.getInstance();
if (listManager.listContains("blockedAddresses", this.chatTransactionData.getSender(), true)) { if (listManager.listContains("blockedAddresses", this.chatTransactionData.getSender(), true)) {