skip excluded address from zsweep

This commit is contained in:
jahway603
2022-09-12 23:30:59 -04:00
parent 78f5021cc2
commit ca3bb90e0c

View File

@@ -88,12 +88,18 @@ bool AsyncRPCOperation_sweep::main_impl() {
std::vector<SaplingNoteEntry> saplingEntries;
libzcash::SaplingPaymentAddress sweepAddress;
libzcash::SaplingPaymentAddress sweepExcludeAddress;
std::map<libzcash::SaplingPaymentAddress, std::vector<SaplingNoteEntry>> mapAddresses;
{
LOCK2(cs_main, pwalletMain->cs_wallet);
pwalletMain->GetFilteredNotes(saplingEntries, "", 11);
if (!fromRPC_) {
auto zAddressExclude = DecodePaymentAddress(pwalletMain->sweepExcludeAddress);
if (boost::get<libzcash::SaplingPaymentAddress>(&zAddressExclude) != nullptr) {
sweepExcludeAddress = boost::get<libzcash::SaplingPaymentAddress>(zAddressExclude);
}
if (fSweepMapUsed) {
const vector<string>& 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 {