From 8317beef1e36219a1abe36c5055713d7ce786f61 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 20 Sep 2020 14:33:15 -0400 Subject: [PATCH] Increase logspam for deletetx=1 and -zdebug --- src/wallet/wallet.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0cc5b81b4..ffab54fd4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2389,6 +2389,8 @@ void CWallet::WitnessNoteCommitment(std::vector commitments, void CWallet::ReorderWalletTransactions(std::map, CWalletTx*> &mapSorted, int64_t &maxOrderPos) { LOCK2(cs_main, cs_wallet); + if(fZdebug) + fprintf(stderr,"%s: maxOrderPos=%li\n",__func__, maxOrderPos); int maxSortNumber = chainActive.Tip()->GetHeight() + 1; @@ -2419,8 +2421,11 @@ void CWallet::UpdateWalletTransactionOrder(std::map, CWalletT int64_t previousPosition = 0; std::map mapUpdatedTxs; + if(fZdebug) + fprintf(stderr,"%s: maxSorted.size=%li\n",__func__, mapSorted.size()); + //Check the postion of each transaction relative to the previous one. -for (map, CWalletTx*>::iterator it = mapSorted.begin(); it != mapSorted.end(); ++it) { + for (map, CWalletTx*>::iterator it = mapSorted.begin(); it != mapSorted.end(); ++it) { CWalletTx* pwtx = it->second; const uint256 wtxid = pwtx->GetHash(); @@ -2456,9 +2461,13 @@ for (map, CWalletTx*>::iterator it = mapSorted.begin(); it != void CWallet::DeleteTransactions(std::vector &removeTxs) { LOCK(cs_wallet); + int numTx = removeTxs.size(); + if(fZdebug) + fprintf(stderr,"%s: removeTxs.size=%d\n", __func__, numTx); + CWalletDB walletdb(strWalletFile, "r+", false); - for (int i = 0; i< removeTxs.size(); i++) { + for (int i = 0; i< numTx; i++) { if (mapWallet.erase(removeTxs[i])) { walletdb.EraseTx(removeTxs[i]); LogPrintf("%s: Deleting tx %s, %i.\n", __func__, removeTxs[i].ToString(),i); @@ -2481,6 +2490,9 @@ void CWallet::DeleteWalletTransactions(const CBlockIndex* pindex) { int nDeleteAfter = (int)fDeleteTransactionsAfterNBlocks; bool runCompact = false; + if(fZdebug) + fprintf(stderr,"%s: nDeleteAfter=%d\n",__func__,nDeleteAfter); + if (pindex && fTxDeleteEnabled) { //Check for acentries - exit function if found @@ -2646,8 +2658,11 @@ void CWallet::DeleteWalletTransactions(const CBlockIndex* pindex) { LogPrintf("Delete Tx - Total Transaction Count %i, Transactions Deleted %i\n ", txCount, int(removeTxs.size())); //Compress Wallet - if (runCompact) - CWalletDB::Compact(bitdb,strWalletFile); + if (runCompact) { + if(fZdebug) + fprintf(stderr,"%s: compacting wallet\n",__func__); + CWalletDB::Compact(bitdb,strWalletFile); + } } } @@ -2689,11 +2704,9 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate) } } - //SproutMerkleTree sproutTree; SaplingMerkleTree saplingTree; // This should never fail: we should always be able to get the tree // state on the path to the tip of our chain - //assert(pcoinsTip->GetSproutAnchorAt(pindex->hashSproutAnchor, sproutTree)); if (pindex->pprev) { if (NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) { assert(pcoinsTip->GetSaplingAnchorAt(pindex->pprev->hashFinalSaplingRoot, saplingTree));