Add z_sweepstatus RPC
This commit is contained in:
@@ -2086,6 +2086,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
auto hasSpendingKey = boost::apply_visitor(HaveSpendingKeyForPaymentAddress(pwalletMain), zSweep);
|
||||
auto allowSweepToExternalWallet = GetArg("-zsweepexternal", false);
|
||||
pwalletMain->sweepAddress = vSweep[i];
|
||||
|
||||
if (!hasSpendingKey) {
|
||||
if (allowSweepToExternalWallet) {
|
||||
|
||||
@@ -472,6 +472,7 @@ extern UniValue z_getbalance(const UniValue& params, bool fHelp, const CPubKey&
|
||||
extern UniValue z_gettotalbalance(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||
extern UniValue z_mergetoaddress(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||
extern UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||
extern UniValue z_sweepstatus(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||
extern UniValue z_shieldcoinbase(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||
extern UniValue z_getoperationstatus(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||
extern UniValue z_getoperationresult(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||
|
||||
@@ -64,7 +64,7 @@ void AsyncRPCOperation_sweep::main() {
|
||||
set_state(OperationStatus::FAILED);
|
||||
}
|
||||
|
||||
std::string s = strprintf("%s: Sapling Sweep transaction created. (status=%s", getId(), getStateAsString());
|
||||
std::string s = strprintf("%s: Sweep transaction created. (status=%s", getId(), getStateAsString());
|
||||
if (success) {
|
||||
s += strprintf(", success)\n");
|
||||
} else {
|
||||
|
||||
@@ -3315,6 +3315,48 @@ UniValue getalldata(const UniValue& params, bool fHelp,const CPubKey&)
|
||||
return returnObj;
|
||||
}
|
||||
|
||||
UniValue z_sweepstatus(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (fHelp || params.size() > 0)
|
||||
throw runtime_error(
|
||||
"z_sweepstatus\n"
|
||||
"\nGive details about zsweep operations since the node was started."
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("z_sweepstatus", "")
|
||||
+ HelpExampleRpc("z_sweepstatus", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
auto amount_swept;
|
||||
ret.push_back(Pair("zsweep", pwalletMain->fSweepEnabled));
|
||||
ret.push_back(Pair("running", pwalletMain->fSweepRunning));
|
||||
ret.push_back(Pair("amount_swept", amount_swept));
|
||||
|
||||
if (pwalletMain->fConsolidationRunning) {
|
||||
ret.push_back(Pair("next_zsweep", pwalletMain->sweepInterval + chainActive.Tip()->GetHeight()));
|
||||
} else {
|
||||
if (pwalletMain->nextConsolidation == 0) {
|
||||
ret.push_back(Pair("next_zsweep", chainActive.Tip()->GetHeight() + 1));
|
||||
} else {
|
||||
ret.push_back(Pair("next_zsweep", pwalletMain->nextSweep));
|
||||
}
|
||||
}
|
||||
ret.push_back(Pair("zsweepinterval", pwalletMain->sweepInterval));
|
||||
ret.push_back(Pair("zsweepaddress", pwalletMain->sweepAddress));
|
||||
ret.push_back(Pair("zsweepmaxinputs", pwalletMain->sweepMaxInputs));
|
||||
ret.push_back(Pair("zsweepfee", pwalletMain->sweepFee));
|
||||
ret.push_back(Pair("zsweepexternal", pwalletMain->fSweepExternalEnabled));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UniValue z_listreceivedaddress(const UniValue& params, bool fHelp,const CPubKey&)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
|
||||
@@ -805,8 +805,12 @@ public:
|
||||
bool fSaplingConsolidationEnabled = false;
|
||||
bool fConsolidationRunning = false;
|
||||
bool fSweepEnabled = false;
|
||||
bool fSweepExternalEnabled = false;
|
||||
bool fSweepRunning = false;
|
||||
int nextSweep = 0;
|
||||
int nextSweep = 0;
|
||||
int sweepInterval = 20;
|
||||
int sweepMaxInputs = 200;
|
||||
std::string sweepAddress = "";
|
||||
|
||||
void ClearNoteWitnessCache();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user