Merge pull request #5423 from nuttycom/fix/orchard_batch_verifydb
Batch-verify Orchard transactions at the block level.
This commit is contained in:
commit
fc1a16f4ff
11
src/main.cpp
11
src/main.cpp
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue