diff --git a/src/lelantus.cpp b/src/lelantus.cpp index 2945a38b50..3d4395cb36 100644 --- a/src/lelantus.cpp +++ b/src/lelantus.cpp @@ -740,8 +740,13 @@ bool CheckLelantusTransaction( if (allowLelantus && !isVerifyDB) { for (const CTxOut &txout : tx.vout) { if (!txout.scriptPubKey.empty() && txout.scriptPubKey.IsLelantusMint()) { - if (!CheckLelantusMintTransaction(txout, state, hashTx, fStatefulSigmaCheck, lelantusTxInfo)) - return false; + try { + if (!CheckLelantusMintTransaction(txout, state, hashTx, fStatefulSigmaCheck, lelantusTxInfo)) + return false; + } + catch (const std::exception &x) { + return state.Error(x.what()); + } } } } @@ -762,10 +767,15 @@ bool CheckLelantusTransaction( } if (!isVerifyDB) { - if (!CheckLelantusJoinSplitTransaction( - tx, state, hashTx, isVerifyDB, nHeight, realHeight, - isCheckWallet, fStatefulSigmaCheck, sigmaTxInfo, lelantusTxInfo)) { - return false; + try { + if (!CheckLelantusJoinSplitTransaction( + tx, state, hashTx, isVerifyDB, nHeight, realHeight, + isCheckWallet, fStatefulSigmaCheck, sigmaTxInfo, lelantusTxInfo)) { + return false; + } + } + catch (const std::exception &x) { + return state.Error(x.what()); } } } diff --git a/src/sigma.cpp b/src/sigma.cpp index 44617859d1..7395e166fd 100644 --- a/src/sigma.cpp +++ b/src/sigma.cpp @@ -455,8 +455,13 @@ bool CheckSigmaTransaction( if (allowSigma) { for (const CTxOut &txout : tx.vout) { if (!txout.scriptPubKey.empty() && txout.scriptPubKey.IsSigmaMint()) { - if (!CheckSigmaMintTransaction(txout, state, hashTx, fStatefulSigmaCheck, sigmaTxInfo)) - return false; + try { + if (!CheckSigmaMintTransaction(txout, state, hashTx, fStatefulSigmaCheck, sigmaTxInfo)) + return false; + } + catch (const std::exception &x) { + return state.Error(x.what()); + } } } } @@ -506,10 +511,15 @@ bool CheckSigmaTransaction( // Check vOut // Only one loop, we checked on the format before entering this case if (!isVerifyDB) { - if (!CheckSigmaSpendTransaction( - tx, denominations, state, hashTx, isVerifyDB, nHeight, realHeight, - isCheckWallet, fStatefulSigmaCheck, sigmaTxInfo)) { - return false; + try { + if (!CheckSigmaSpendTransaction( + tx, denominations, state, hashTx, isVerifyDB, nHeight, realHeight, + isCheckWallet, fStatefulSigmaCheck, sigmaTxInfo)) { + return false; + } + } + catch (const std::exception &x) { + return state.Error(x.what()); } } } diff --git a/src/validation.cpp b/src/validation.cpp index fe3aab3c6a..5374a9c3a1 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1494,7 +1494,14 @@ bool AcceptToMemoryPoolWithTime(CTxMemPool& pool, CValidationState &state, const { LogPrintf("AcceptToMemoryPool(), transaction: %s\n", tx->GetHash().ToString()); std::vector coins_to_uncache; - bool res = AcceptToMemoryPoolWorker(pool, state, tx, fLimitFree, pfMissingInputs, nAcceptTime, plTxnReplaced, fOverrideMempoolLimit, nAbsurdFee, coins_to_uncache, isCheckWalletTransaction, markFiroSpendTransactionSerial); + bool res = false; + try { + res = AcceptToMemoryPoolWorker(pool, state, tx, fLimitFree, pfMissingInputs, nAcceptTime, plTxnReplaced, fOverrideMempoolLimit, nAbsurdFee, coins_to_uncache, isCheckWalletTransaction, markFiroSpendTransactionSerial); + } + catch (const std::exception &x) { + state.Error(x.what()); + res = false; + } if (!res) { BOOST_FOREACH(const COutPoint& hashTx, coins_to_uncache) pcoinsTip->Uncache(hashTx);