Support multiple zsweepexclude zaddrs

This commit is contained in:
Jonathan "Duke" Leto
2022-09-16 10:08:53 -07:00
parent 6b79b3e12c
commit f796d5d14e
3 changed files with 32 additions and 11 deletions

View File

@@ -2121,17 +2121,17 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
for (int i = 0; i < vSweepExclude.size(); i++) {
LogPrintf("Sweep Excluded Address: %s\n", vSweepExclude[i]);
pwalletMain->sweepExcludeAddress = vSweepExclude[i];
auto zSweepExcluded = DecodePaymentAddress(vSweepExclude[i]);
if (!IsValidPaymentAddress(zSweepExcluded)) {
return InitError("Invalid zsweep address");
}
auto hasSpendingKey = boost::apply_visitor(HaveSpendingKeyForPaymentAddress(pwalletMain), zSweepExcluded);
pwalletMain->sweepExcludeAddress = vSweepExclude[i];
if (!hasSpendingKey) {
return InitError("Wallet must have the spending key of zsweepexclude address");
}
// Add this validated zaddr to the list of excluded sweep zaddrs
pwalletMain->sweepExcludeAddresses.push_back( vSweepExclude[i] );
}
if (pwalletMain->fSaplingConsolidationEnabled) {