Browse Source

skip excluded address from zsweep

pull/195/head
jahway603 2 years ago
parent
commit
ca3bb90e0c
  1. 11
      src/wallet/asyncrpcoperation_sweep.cpp

11
src/wallet/asyncrpcoperation_sweep.cpp

@ -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 {

Loading…
Cancel
Save