Compare commits
4 Commits
autoshield
...
1ec6590fb7
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ec6590fb7 | |||
| 92e6c7008d | |||
| 733df964ec | |||
| d12e7dc99d |
@@ -369,6 +369,7 @@ extern UniValue z_gettotalbalance(const UniValue& params, bool fHelp, const CPub
|
|||||||
extern UniValue z_mergetoaddress(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_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_sweepstatus(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||||
|
extern UniValue z_autoshieldstatus(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||||
extern UniValue z_consolidationstatus(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
extern UniValue z_consolidationstatus(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_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_getoperationstatus(const UniValue& params, bool fHelp, const CPubKey& mypk); // in rpcwallet.cpp
|
||||||
|
|||||||
@@ -3345,6 +3345,77 @@ UniValue z_sweepstatus(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UniValue z_autoshieldstatus(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
|
{
|
||||||
|
if (!EnsureWalletIsAvailable(fHelp))
|
||||||
|
return NullUniValue;
|
||||||
|
|
||||||
|
if (fHelp || params.size() > 0)
|
||||||
|
throw runtime_error(
|
||||||
|
"z_autoshieldstatus\n"
|
||||||
|
"\nReport the state of automatic coinbase shielding: whether it is on, where it sends,\n"
|
||||||
|
"and -- when it is off -- why.\n"
|
||||||
|
"\nResult:\n"
|
||||||
|
"{\n"
|
||||||
|
" \"autoshield\" : true|false, (boolean) whether auto-shielding is enabled\n"
|
||||||
|
" \"running\" : true|false, (boolean) whether a round is in flight\n"
|
||||||
|
" \"next_autoshield\" : n, (numeric) height of the next round\n"
|
||||||
|
" \"autoshieldinterval\" : n, (numeric) blocks between rounds\n"
|
||||||
|
" \"autoshieldaddress\" : \"zaddr\", (string) resolved destination; empty until first resolved\n"
|
||||||
|
" \"autoshieldfee\" : n, (numeric) fee in puposhis\n"
|
||||||
|
" \"autoshieldminutxos\" : n, (numeric) minimum matured coinbase utxos per round\n"
|
||||||
|
" \"hdseedorigin\" : n, (numeric) 0 unrecorded, 1 created, 2 restored, 3 retrofit, 4 unknown\n"
|
||||||
|
" \"hdseedorigin_desc\" : \"...\", (string) readable form of hdseedorigin\n"
|
||||||
|
" \"seed_recoverable\" : true|false, (boolean) whether a seed phrase can be exported\n"
|
||||||
|
" \"disabled_reason\" : \"...\" (string) why auto-shielding is not running, if it is not\n"
|
||||||
|
"}\n"
|
||||||
|
"\nExamples:\n"
|
||||||
|
+ HelpExampleCli("z_autoshieldstatus", "")
|
||||||
|
+ HelpExampleRpc("z_autoshieldstatus", "")
|
||||||
|
);
|
||||||
|
|
||||||
|
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||||
|
|
||||||
|
UniValue ret(UniValue::VOBJ);
|
||||||
|
ret.push_back(Pair("autoshield", pwalletMain->fAutoShieldEnabled));
|
||||||
|
ret.push_back(Pair("running", pwalletMain->fAutoShieldRunning));
|
||||||
|
ret.push_back(Pair("next_autoshield", pwalletMain->nextAutoShield));
|
||||||
|
ret.push_back(Pair("autoshieldinterval", pwalletMain->autoShieldInterval));
|
||||||
|
ret.push_back(Pair("autoshieldaddress", pwalletMain->autoShieldAddress));
|
||||||
|
ret.push_back(Pair("autoshieldfee", pwalletMain->autoShieldFee));
|
||||||
|
ret.push_back(Pair("autoshieldminutxos", pwalletMain->autoShieldMinUtxos));
|
||||||
|
|
||||||
|
int origin = pwalletMain->hdSeedOrigin;
|
||||||
|
std::string desc;
|
||||||
|
switch (origin) {
|
||||||
|
case CWallet::HDSEED_ORIGIN_CREATED: desc = "created on an empty wallet"; break;
|
||||||
|
case CWallet::HDSEED_ORIGIN_RESTORED: desc = "restored from -mnemonic/-hdseed"; break;
|
||||||
|
case CWallet::HDSEED_ORIGIN_RETROFIT: desc = "retrofitted onto a pre-existing wallet"; break;
|
||||||
|
case CWallet::HDSEED_ORIGIN_UNKNOWN: desc = "predates provenance recording"; break;
|
||||||
|
default: desc = "not yet recorded"; break;
|
||||||
|
}
|
||||||
|
ret.push_back(Pair("hdseedorigin", origin));
|
||||||
|
ret.push_back(Pair("hdseedorigin_desc", desc));
|
||||||
|
ret.push_back(Pair("seed_recoverable", pwalletMain->IsMnemonicSeed()));
|
||||||
|
|
||||||
|
// Say why it is off. A silent "false" is exactly what made the destination
|
||||||
|
// un-inspectable in the first place.
|
||||||
|
std::string why = "";
|
||||||
|
if (!pwalletMain->fAutoShieldEnabled) {
|
||||||
|
if (origin != CWallet::HDSEED_ORIGIN_CREATED && origin != CWallet::HDSEED_ORIGIN_RESTORED)
|
||||||
|
why = "HD seed origin is not known-recoverable; back the seed up and pass -autoshield=1";
|
||||||
|
else
|
||||||
|
why = "disabled by -autoshield=0";
|
||||||
|
} else if (pwalletMain->IsLocked()) {
|
||||||
|
why = "wallet is locked; rounds are skipped until it is unlocked";
|
||||||
|
} else if (pwalletMain->autoShieldAddress.empty()) {
|
||||||
|
why = "";
|
||||||
|
}
|
||||||
|
ret.push_back(Pair("disabled_reason", why));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
UniValue z_listreceivedaddress(const UniValue& params, bool fHelp,const CPubKey&)
|
UniValue z_listreceivedaddress(const UniValue& params, bool fHelp,const CPubKey&)
|
||||||
{
|
{
|
||||||
if (!EnsureWalletIsAvailable(fHelp))
|
if (!EnsureWalletIsAvailable(fHelp))
|
||||||
@@ -6349,6 +6420,7 @@ static const CRPCCommand commands[] =
|
|||||||
{ "wallet", "z_gettotalbalance", &z_gettotalbalance, false },
|
{ "wallet", "z_gettotalbalance", &z_gettotalbalance, false },
|
||||||
{ "wallet", "z_mergetoaddress", &z_mergetoaddress, false },
|
{ "wallet", "z_mergetoaddress", &z_mergetoaddress, false },
|
||||||
{ "wallet", "z_sweepstatus", &z_sweepstatus, true },
|
{ "wallet", "z_sweepstatus", &z_sweepstatus, true },
|
||||||
|
{ "wallet", "z_autoshieldstatus", &z_autoshieldstatus, true },
|
||||||
{ "wallet", "z_consolidationstatus", &z_consolidationstatus, true },
|
{ "wallet", "z_consolidationstatus", &z_consolidationstatus, true },
|
||||||
{ "wallet", "z_sendmany", &z_sendmany, false },
|
{ "wallet", "z_sendmany", &z_sendmany, false },
|
||||||
{ "wallet", "z_shieldcoinbase", &z_shieldcoinbase, false },
|
{ "wallet", "z_shieldcoinbase", &z_shieldcoinbase, false },
|
||||||
|
|||||||
@@ -34,6 +34,15 @@
|
|||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
|
// Out-of-line definitions for CHDChain's in-class static constants. These are
|
||||||
|
// only initialised in the class body, so any ODR use -- binding one to a const
|
||||||
|
// reference, which is exactly what gtest's EXPECT_*/ASSERT_* macros do -- needs
|
||||||
|
// a definition or the link fails. hush-gtest hit this on VERSION_HD_MNEMONIC.
|
||||||
|
const int CHDChain::VERSION_HD_BASE;
|
||||||
|
const int CHDChain::VERSION_HD_TRANSPARENT;
|
||||||
|
const int CHDChain::VERSION_HD_MNEMONIC;
|
||||||
|
const int CHDChain::CURRENT_VERSION;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static uint64_t nAccountingEntryNumber = 0;
|
static uint64_t nAccountingEntryNumber = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user