Improved PublicizeTransaction validation.

This commit is contained in:
CalDescent 2022-12-22 18:03:29 +00:00
parent 0e81665a36
commit 4aea29a91b

View File

@ -4,7 +4,9 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import org.qortal.account.Account; import org.qortal.account.Account;
import org.qortal.account.PublicKeyAccount;
import org.qortal.api.resource.TransactionsResource.ConfirmationStatus; import org.qortal.api.resource.TransactionsResource.ConfirmationStatus;
import org.qortal.asset.Asset;
import org.qortal.crypto.MemoryPoW; import org.qortal.crypto.MemoryPoW;
import org.qortal.data.transaction.PublicizeTransactionData; import org.qortal.data.transaction.PublicizeTransactionData;
import org.qortal.data.transaction.TransactionData; import org.qortal.data.transaction.TransactionData;
@ -102,6 +104,12 @@ public class PublicizeTransaction extends Transaction {
if (!verifyNonce()) if (!verifyNonce())
return ValidationResult.INCORRECT_NONCE; return ValidationResult.INCORRECT_NONCE;
// Validate fee if one has been included
PublicKeyAccount creator = this.getCreator();
if (this.transactionData.getFee() > 0)
if (creator.getConfirmedBalance(Asset.QORT) < this.transactionData.getFee())
return ValidationResult.NO_BALANCE;
return ValidationResult.OK; return ValidationResult.OK;
} }