Add z_consolidationstatus RPC
This commit is contained in:
@@ -3315,6 +3315,45 @@ UniValue getalldata(const UniValue& params, bool fHelp,const CPubKey&)
|
||||
return returnObj;
|
||||
}
|
||||
|
||||
UniValue z_consolidationstatus(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (fHelp || params.size() > 0)
|
||||
throw runtime_error(
|
||||
"z_consolidationstatus\n"
|
||||
"\nGive details about consolidation operations since the node was started."
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("z_consolidationstatus", "")
|
||||
+ HelpExampleRpc("z_consolidationstatus", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.push_back(Pair("consolidation", pwalletMain->fConsolidationEnabled));
|
||||
ret.push_back(Pair("running", pwalletMain->fConsolidationRunning));
|
||||
ret.push_back(Pair("amount_consolidated", pwalletMain->amountConsolidated));
|
||||
|
||||
if (pwalletMain->fConsolidationRunning) {
|
||||
ret.push_back(Pair("next_consolidation", pwalletMain->consolidationInterval + chainActive.Tip()->GetHeight()));
|
||||
} else {
|
||||
if (pwalletMain->nextConsolidation == 0) {
|
||||
ret.push_back(Pair("next_consolidation", chainActive.Tip()->GetHeight() + 1));
|
||||
} else {
|
||||
ret.push_back(Pair("next_consolidation", pwalletMain->nextConsolidation));
|
||||
}
|
||||
}
|
||||
ret.push_back(Pair("consolidationinterval", pwalletMain->consolidationInterval));
|
||||
ret.push_back(Pair("consolidationaddress", pwalletMain->consolidationAddress));
|
||||
ret.push_back(Pair("consolidationtxfee",(int)fConsolidationTxFee));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
UniValue z_sweepstatus(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
|
||||
@@ -8537,6 +8576,7 @@ static const CRPCCommand commands[] =
|
||||
{ "wallet", "z_gettotalbalance", &z_gettotalbalance, false },
|
||||
{ "wallet", "z_mergetoaddress", &z_mergetoaddress, false },
|
||||
{ "wallet", "z_sweepstatus", &z_sweepstatus, true },
|
||||
{ "wallet", "z_consolidationstatus", &z_consolidationstatus, true },
|
||||
{ "wallet", "z_sendmany", &z_sendmany, false },
|
||||
{ "wallet", "z_shieldcoinbase", &z_shieldcoinbase, false },
|
||||
{ "wallet", "z_getoperationstatus", &z_getoperationstatus, true },
|
||||
|
||||
Reference in New Issue
Block a user