Batch-verify Orchard transactions at the block level.

Fixes #5316
This commit is contained in:
Kris Nuttycombe 2021-12-16 08:58:14 -07:00
parent 7aaefab2d7
commit 99b2098f89
1 changed files with 8 additions and 3 deletions

View File

@ -5374,12 +5374,13 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
// Flags used to permit skipping checks for efficiency
auto verifier = ProofVerifier::Disabled(); // No need to verify JoinSplits twice
bool fCheckTransactions = true;
// We may as well check Orchard authorizations if we are checking
// transactions, since we can batch-validate them.
auto orchardAuth = orchard::AuthValidator::Batch();
for (CBlockIndex* pindex = chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev)
{
// We may as well check Orchard authorizations if we are checking
// transactions, since we can batch-validate them.
auto orchardAuth = orchard::AuthValidator::Batch();
boost::this_thread::interruption_point();
uiInterface.ShowProgress(_("Verifying blocks..."), std::max(1, std::min(99, (int)(((double)(chainActive.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100)))));
if (pindex->nHeight < chainActive.Height()-nCheckDepth)
@ -5421,6 +5422,10 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
}
}
if (!orchardAuth.Validate()) {
return error("VerifyDB(): Orchard batch validation failed for block at height %d", pindex->nHeight);
}
if (ShutdownRequested())
return true;
}