From ca3bb90e0c2a5ccd852c75c4511557280aef680a Mon Sep 17 00:00:00 2001 From: jahway603 Date: Mon, 12 Sep 2022 23:30:59 -0400 Subject: [PATCH] skip excluded address from zsweep --- src/wallet/asyncrpcoperation_sweep.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wallet/asyncrpcoperation_sweep.cpp b/src/wallet/asyncrpcoperation_sweep.cpp index 1e7d324af..82dc1a40c 100644 --- a/src/wallet/asyncrpcoperation_sweep.cpp +++ b/src/wallet/asyncrpcoperation_sweep.cpp @@ -88,12 +88,18 @@ bool AsyncRPCOperation_sweep::main_impl() { std::vector saplingEntries; libzcash::SaplingPaymentAddress sweepAddress; + libzcash::SaplingPaymentAddress sweepExcludeAddress; std::map> mapAddresses; { LOCK2(cs_main, pwalletMain->cs_wallet); pwalletMain->GetFilteredNotes(saplingEntries, "", 11); + if (!fromRPC_) { + auto zAddressExclude = DecodePaymentAddress(pwalletMain->sweepExcludeAddress); + if (boost::get(&zAddressExclude) != nullptr) { + sweepExcludeAddress = boost::get(zAddressExclude); + } if (fSweepMapUsed) { const vector& v = mapMultiArgs["-zsweepaddress"]; for(int i = 0; i < v.size(); i++) { @@ -115,8 +121,11 @@ bool AsyncRPCOperation_sweep::main_impl() { } } + // Map all notes by address for (auto & entry : saplingEntries) { - //Map all notes by address + // do not need to sweep Excluded Address + if (sweepExcludeAddress == entry.address) { continue; } + // do not need to sweep the sweepAddress as that is the destination if (sweepAddress == entry.address) { continue; } else {