diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1f2c55930..8994e217f 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1387,6 +1387,9 @@ int CWallet::VerifyAndSetInitialWitness(const CBlockIndex* pindex, bool witnessO int nWitnessTxIncrement = 0; int nWitnessTotalTxCount = mapWallet.size(); int nMinimumHeight = pindex->GetHeight(); + // For the end-of-pass summary only; no decision reads them. + const int64_t nPassStart = GetTimeMicros(); + int nNotesValidated = 0, nNotesReseeded = 0, nNotesKnownGood = 0, nNotesAhead = 0; // root() walks a witness's whole depth-32 path, ~1.7-2.4ms, and after a restart every note needs // one: ~30s for a 16k-note wallet, with cs_main and cs_wallet held. So compute those roots first, @@ -1478,11 +1481,14 @@ int CWallet::VerifyAndSetInitialWitness(const CBlockIndex* pindex, bool witnessO if (!nd->witnesses.empty() && nd->witnessHeight > 0) { //Skip all functions for validated witness while witness only = true - if (nd->witnessRootValidated && witnessOnly) + if (nd->witnessRootValidated && witnessOnly) { + nNotesKnownGood++; continue; + } //Skip Validation when witness root has been validated if (nd->witnessRootValidated) { + nNotesKnownGood++; nMinimumHeight = SaplingWitnessMinimumHeight(item.second.nullifier, nd->witnessHeight, nMinimumHeight); continue; } @@ -1495,11 +1501,13 @@ int CWallet::VerifyAndSetInitialWitness(const CBlockIndex* pindex, bool witnessO CBlockIndex* whIndex = chainActive[nd->witnessHeight]; if (whIndex == NULL) { //witnessHeight strictly above the active chain (transient catch-up): cannot validate yet + nNotesAhead++; nMinimumHeight = SaplingWitnessMinimumHeight(item.second.nullifier, nd->witnessHeight, nMinimumHeight); continue; } if (cachedRoot(nd) == whIndex->hashFinalSaplingRoot) { nd->witnessRootValidated = true; + nNotesValidated++; nMinimumHeight = SaplingWitnessMinimumHeight(item.second.nullifier, nd->witnessHeight, nMinimumHeight); continue; } @@ -1512,6 +1520,7 @@ int CWallet::VerifyAndSetInitialWitness(const CBlockIndex* pindex, bool witnessO blockRoot = pblockindex->hashFinalSaplingRoot; if (witnessRoot == blockRoot) { nd->witnessRootValidated = true; + nNotesValidated++; nMinimumHeight = SaplingWitnessMinimumHeight(item.second.nullifier, nd->witnessHeight, nMinimumHeight); continue; } @@ -1521,8 +1530,11 @@ int CWallet::VerifyAndSetInitialWitness(const CBlockIndex* pindex, bool witnessO pblockindex = chainActive[wtxHeight]; ::ClearSingleNoteWitnessCache(nd); nWitnessGeneration++; + nNotesReseeded++; - LogPrintf("%s: Setting Initial Sapling Witness for tx %s, %i of %i\n", __func__, wtxHash.ToString(), nWitnessTxIncrement, nWitnessTotalTxCount); + //The GUI parses this line (the hash between "for tx " and the comma, and the count after " of "): + //keep that part as it is and only append. of is the tx's place in mapWallet, not a note count. + LogPrintf("%s: Setting Initial Sapling Witness for tx %s, %i of %i [reseed %d]\n", __func__, wtxHash.ToString(), nWitnessTxIncrement, nWitnessTotalTxCount, nNotesReseeded); SaplingMerkleTree saplingTree; blockRoot = pblockindex->pprev->hashFinalSaplingRoot; @@ -1570,6 +1582,10 @@ int CWallet::VerifyAndSetInitialWitness(const CBlockIndex* pindex, bool witnessO } } + if (nNotesValidated > 0 || nNotesReseeded > 0) + LogPrintf("%s: block %d: %d note witness(es) validated, %d reseeded, %d already valid, %d ahead of the chain; " + "lowest witness height %d; %ldms\n", __func__, pindex->GetHeight(), nNotesValidated, nNotesReseeded, + nNotesKnownGood, nNotesAhead, nMinimumHeight, (long)((GetTimeMicros() - nPassStart) / 1000)); if(fZdebug) LogPrintf("%s: nMinimumHeight=%d\n",__func__, nMinimumHeight); return nMinimumHeight;