File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -727,10 +727,24 @@ void CTxMemPool::check(const CCoinsViewCache* pcoins) const
727727 assert (it->first == it->second .ptx ->vin [it->second .n ].prevout );
728728 }
729729
730+ // Consistency check for sapling nullifiers
731+ checkNullifiers ();
732+
730733 assert (totalTxSize == checkTotal);
731734 assert (innerUsage == cachedInnerUsage);
732735}
733736
737+ void CTxMemPool::checkNullifiers () const
738+ {
739+ for (const auto & it : mapSaplingNullifiers) {
740+ const uint256& hash = it.second ->GetHash ();
741+ const auto & findTx = mapTx.find (hash);
742+ assert (findTx != mapTx.end ());
743+ const CTransaction& tx = findTx->GetTx ();
744+ assert (&tx == it.second );
745+ }
746+ }
747+
734748void CTxMemPool::queryHashes (std::vector<uint256>& vtxid)
735749{
736750 vtxid.clear ();
Original file line number Diff line number Diff line change @@ -469,6 +469,7 @@ class CTxMemPool
469469 */
470470 void check (const CCoinsViewCache *pcoins) const ;
471471 void setSanityCheck (double dFrequency = 1.0 ) { nCheckFrequency = dFrequency * 4294967295.0 ; }
472+ void checkNullifiers () const ;
472473
473474 // addUnchecked must updated state for all ancestors of a given transaction,
474475 // to track size/count of descendant transactions. First version of
You can’t perform that action at this time.
0 commit comments