Skip to content

Commit

Permalink
fix spendspark corner case crash
Browse files Browse the repository at this point in the history
  • Loading branch information
levonpetrosyan93 committed Jun 4, 2023
1 parent 4b6bd29 commit 33d6d5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,13 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
assert(linksiter != mapLinks.end());
const TxLinks &links = linksiter->second;
innerUsage += memusage::DynamicUsage(links.children);
if (!tx.IsSigmaSpend() && !tx.IsLelantusJoinSplit())
if (!tx.IsSigmaSpend() && !tx.IsLelantusJoinSplit() && !tx.IsSparkSpend())
innerUsage += memusage::DynamicUsage(links.parents);
bool fDependsWait = false;
setEntries setParentCheck;
int64_t parentSizes = 0;
int64_t parentSigOpCost = 0;
if (!tx.IsSigmaSpend() && !tx.IsLelantusJoinSplit()) {
if (!tx.IsSigmaSpend() && !tx.IsLelantusJoinSplit() && !tx.IsSparkSpend()) {
BOOST_FOREACH(const CTxIn &txin, tx.vin) {
// Check that every mempool transaction's inputs refer to available coins, or other mempool tx's.
indexed_transaction_set::const_iterator it2 = mapTx.find(txin.prevout.hash);
Expand Down Expand Up @@ -1210,7 +1210,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
waitingOnDependants.push_back(&(*it));
else {
CValidationState state;
bool fCheckResult = tx.IsCoinBase() || tx.IsSigmaSpend() || tx.IsLelantusJoinSplit() ||
bool fCheckResult = tx.IsCoinBase() || tx.IsSigmaSpend() || tx.IsLelantusJoinSplit() || tx.IsSparkSpend() ||
Consensus::CheckTxInputs(tx, state, mempoolDuplicate, nSpendHeight);

assert(fCheckResult);
Expand All @@ -1228,7 +1228,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
assert(stepsSinceLastRemove < waitingOnDependants.size());
} else {
const CTransaction &tx = entry->GetTx();
bool fCheckResult = tx.IsCoinBase() || tx.IsSigmaSpend() || tx.IsLelantusJoinSplit() ||
bool fCheckResult = tx.IsCoinBase() || tx.IsSigmaSpend() || tx.IsLelantusJoinSplit() || tx.IsSparkSpend() ||
Consensus::CheckTxInputs(entry->GetTx(), state, mempoolDuplicate, nSpendHeight);
assert(fCheckResult);
UpdateCoins(entry->GetTx(), mempoolDuplicate, 1000000);
Expand Down
2 changes: 1 addition & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ bool CheckTransaction(const CTransaction &tx, CValidationState &state, bool fChe
bool const check_di = nHeight != INT_MAX && nHeight > ::Params().GetConsensus().nStartDuplicationCheck;
if (fCheckDuplicateInputs || check_di) {
std::set<COutPoint> vInOutPoints;
if (tx.IsSigmaSpend() || tx.IsLelantusJoinSplit()) {
if (tx.IsSigmaSpend() || tx.IsLelantusJoinSplit() || tx.IsSparkSpend()) {
std::set<CScript> spendScripts;
for (const auto& txin: tx.vin)
{
Expand Down

0 comments on commit 33d6d5c

Please sign in to comment.