starting to support zsweepexclude functionality
This commit is contained in:
16
src/init.cpp
16
src/init.cpp
@@ -471,6 +471,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
// By default we only allow sweeping to the current wallet which must have the spending key of the sweep zaddr
|
||||
// This hopefully will make it harder for people to accidentally sweep funds to a wrong zaddr and lose funds
|
||||
strUsage += HelpMessageOpt("-zsweepexternal", _("Enable sweeping to an external wallet (default false)"));
|
||||
strUsage += HelpMessageOpt("-zsweepexclude", _("Addresses to exclude from sweeping (default none)"));
|
||||
|
||||
strUsage += HelpMessageOpt("-deletetx", _("Enable Old Transaction Deletion"));
|
||||
strUsage += HelpMessageOpt("-deleteinterval", strprintf(_("Delete transaction every <n> blocks during inital block download (default: %i)"), DEFAULT_TX_DELETE_INTERVAL));
|
||||
@@ -2094,6 +2095,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
|
||||
//Validate Sapling Addresses
|
||||
vector<string>& vSweep = mapMultiArgs["-zsweepaddress"];
|
||||
vector<string>& vSweepExclude = mapMultiArgs["-zsweepexclude"];
|
||||
if (vSweep.size() != 1) {
|
||||
return InitError("A single zsweep address must be specified.");
|
||||
}
|
||||
@@ -2117,6 +2119,20 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < vSweepExclude.size(); i++) {
|
||||
// LogPrintf("Sweep Excluded Address: %s\n", 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");
|
||||
}
|
||||
}
|
||||
|
||||
if (pwalletMain->fSaplingConsolidationEnabled) {
|
||||
//Validate 1 Consolidation address only that matches the sweep address
|
||||
vector<string>& vaddresses = mapMultiArgs["-consolidatesaplingaddress"];
|
||||
|
||||
Reference in New Issue
Block a user