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 {