From c99e7752e411f8fe1a5fbfa4293f2ebd2eed59be Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 1 Apr 2022 19:40:29 +0000 Subject: [PATCH] mempool: Remove duplicated anchor and nullifier assertions Now that we call `Consensus::CheckTxShieldedInputs` on all transactions in `CTxMemPool::check`, we don't need to separately check the nullifiers and anchors directly. That change also fixed a bug where we weren't previously making the same assertions about Orchard Actions. --- src/txmempool.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 420167b45..20ef443fb 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -583,36 +583,6 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const i++; } - // The SaltedTxidHasher is fine to use here; it salts the map keys automatically - // with randomness generated on construction. - boost::unordered_map intermediates; - - for (const JSDescription &joinsplit : tx.vJoinSplit) { - for (const uint256 &nf : joinsplit.nullifiers) { - assert(!pcoins->GetNullifier(nf, SPROUT)); - } - - SproutMerkleTree tree; - auto it = intermediates.find(joinsplit.anchor); - if (it != intermediates.end()) { - tree = it->second; - } else { - assert(pcoins->GetSproutAnchorAt(joinsplit.anchor, tree)); - } - - for (const uint256& commitment : joinsplit.commitments) - { - tree.append(commitment); - } - - intermediates.insert(std::make_pair(tree.root(), tree)); - } - for (const SpendDescription &spendDescription : tx.vShieldedSpend) { - SaplingMerkleTree tree; - - assert(pcoins->GetSaplingAnchorAt(spendDescription.anchor, tree)); - assert(!pcoins->GetNullifier(spendDescription.nullifier, SAPLING)); - } if (fDependsWait) waitingOnDependants.push_back(&(*it)); else {