From 8a4e72fca2e0b41dc9f6875a40c2ceba048029eb Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Fri, 8 May 2020 08:57:34 -0400 Subject: [PATCH 1/3] Remove some sprout code from BuildWitnessCache --- src/wallet/wallet.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 53b3af6a6..546d9a547 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1288,10 +1288,6 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly) LogPrintf("Building Witnesses for block %i %.4f complete\n", pblockindex->GetHeight(), pblockindex->GetHeight() / double(height)); } - SproutMerkleTree sproutTree; - sproutRoot = pblockindex->pprev->hashFinalSproutRoot; - pcoinsTip->GetSproutAnchorAt(sproutRoot, sproutTree); - SaplingMerkleTree saplingTree; saplingRoot = pblockindex->pprev->hashFinalSaplingRoot; pcoinsTip->GetSaplingAnchorAt(saplingRoot, saplingTree); From dd5d932f8711c17e66fde407c1cdf2d0ae7aedf1 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 11 May 2020 06:34:48 -0400 Subject: [PATCH 2/3] Only print these when -zdebug is turned on --- src/wallet/rpcwallet.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5afd0c4e8..37f67042b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4388,7 +4388,9 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp, const CPubKey& my // Fetch the note that is being spent auto res = pwalletMain->mapSaplingNullifiersToNotes.find(spend.nullifier); if (res == pwalletMain->mapSaplingNullifiersToNotes.end()) { - fprintf(stderr,"Could not find spending note %s", uint256_str(str, spend.nullifier)); + if(fZdebug) { + fprintf(stderr,"Could not find spending note %s\n", uint256_str(str, spend.nullifier)); + } continue; } auto op = res->second; @@ -4442,8 +4444,10 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp, const CPubKey& my pa = recovered->second; isOutgoing = true; } else { - // Unreadable - fprintf(stderr,"Could not recover Sapling note!"); + // Unreadable or unconfirmed? + if(fZdebug) { + fprintf(stderr,"Could not recover Sapling note!\n"); + } continue; } } From 095157d2d97de6da7de24ab168d36b383a6dbda3 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 11 May 2020 06:42:01 -0400 Subject: [PATCH 3/3] Remove sprout junk --- src/wallet/wallet.cpp | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 546d9a547..8d56fdfae 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1298,7 +1298,7 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly) for (std::pair& wtxItem : mapWallet) { - if (wtxItem.second.mapSproutNoteData.empty() && wtxItem.second.mapSaplingNoteData.empty()) + if (wtxItem.second.mapSaplingNoteData.empty()) continue; if (wtxItem.second.GetDepthInMainChain() > 0) { @@ -3062,38 +3062,11 @@ void CWallet::DeleteWalletTransactions(const CBlockIndex* pindex) { continue; } - //Check for unspent inputs or spend less than N Blocks ago. (Sprout) - for (auto & pair : pwtx->mapSproutNoteData) { - SproutNoteData nd = pair.second; - if (!nd.nullifier || pwalletMain->GetSproutSpendDepth(*nd.nullifier) <= fDeleteTransactionsAfterNBlocks) { - LogPrint("deletetx","DeleteTx - Unspent sprout input tx %s\n", pwtx->GetHash().ToString()); - deleteTx = false; - continue; - } - } - if (!deleteTx) { txSaveCount++; continue; } - //Check for outputs that no longer have parents in the wallet. Exclude parents that are in the same transaction. (Sprout) - for (int i = 0; i < pwtx->vjoinsplit.size(); i++) { - const JSDescription& jsdesc = pwtx->vjoinsplit[i]; - for (const uint256 &nullifier : jsdesc.nullifiers) { - // JSOutPoint op = pwalletMain->mapSproutNullifiersToNotes[nullifier]; - if (pwalletMain->IsSproutNullifierFromMe(nullifier)) { - const uint256& parentHash = pwalletMain->mapSproutNullifiersToNotes[nullifier].hash; - const CWalletTx* parent = pwalletMain->GetWalletTx(parentHash); - if (parent != NULL && parentHash != wtxid) { - LogPrint("deletetx","DeleteTx - Parent of sprout tx %s found\n", pwtx->GetHash().ToString()); - deleteTx = false; - continue; - } - } - } - } - if (!deleteTx) { txSaveCount++; continue;