From ce1a3a1ea13774acefea1fdaadeaa910f2cf8bf8 Mon Sep 17 00:00:00 2001 From: levonpetrosyan93 Date: Fri, 26 Jan 2024 19:06:04 +0400 Subject: [PATCH] Disable spark tx creation when spork is active --- src/spark/sparkwallet.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/spark/sparkwallet.cpp b/src/spark/sparkwallet.cpp index 822aafdaff..4c767b4fe5 100644 --- a/src/spark/sparkwallet.cpp +++ b/src/spark/sparkwallet.cpp @@ -1153,6 +1153,14 @@ bool CSparkWallet::CreateSparkMintTransactions( nIn++; } + { + CValidationState state; + if (!mempool.IsTransactionAllowed(*wtx.tx, state)) { + strFailReason = _("Signing transaction failed"); + return false; + } + } + wtx.SetTx(MakeTransactionRef(std::move(tx))); wtxAndFee.push_back(std::make_pair(wtx, nFeeRet)); @@ -1548,7 +1556,13 @@ CWalletTx CSparkWallet::CreateSparkSpendTransaction( result.push_back(wtxNew); } } - + { + CValidationState state; + for (CWalletTx& wtx : result) { + if (!mempool.IsTransactionAllowed(*wtx.tx, state)) + throw std::invalid_argument(_("Spark transactions are disabled at the moment")); + } + } if (GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS)) { // Lastly, ensure this tx will pass the mempool's chain limits size_t nLimitAncestors = GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT);