Skip to content

Commit c74e86e

Browse files
committed
[Mempool] Consistency check: nullifiers for notes spent in mempool txes
are unspent in the coins view cache
1 parent 3dfc4fd commit c74e86e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/txmempool.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,14 @@ void CTxMemPool::check(const CCoinsViewCache* pcoins) const
662662
}
663663
i++;
664664
}
665+
// sapling txes
666+
if (tx.IsShieldedTx()) {
667+
for (const SpendDescription& sd : tx.sapData->vShieldedSpend) {
668+
SaplingMerkleTree tree;
669+
assert(pcoins->GetSaplingAnchorAt(sd.anchor, tree));
670+
assert(!pcoins->GetNullifier(sd.nullifier));
671+
}
672+
}
665673
assert(setParentCheck == GetMemPoolParents(it));
666674
// Check children against mapNextTx
667675
if (!fHasZerocoinSpends) {
@@ -718,7 +726,7 @@ void CTxMemPool::check(const CCoinsViewCache* pcoins) const
718726
}
719727
}
720728
for (std::map<COutPoint, CInPoint>::const_iterator it = mapNextTx.begin(); it != mapNextTx.end(); it++) {
721-
uint256 hash = it->second.ptx->GetHash();
729+
const uint256& hash = it->second.ptx->GetHash();
722730
indexed_transaction_set::const_iterator it2 = mapTx.find(hash);
723731
const CTransaction& tx = it2->GetTx();
724732
assert(it2 != mapTx.end());

0 commit comments

Comments
 (0)