wallet: fix shared ring db path
This commit is contained in:
parent
9bc8f76924
commit
0da5d37bf3
|
@ -69,12 +69,16 @@ namespace {
|
||||||
// Connection timeout 30 sec
|
// Connection timeout 30 sec
|
||||||
static const int DEFAULT_CONNECTION_TIMEOUT_MILLIS = 1000 * 30;
|
static const int DEFAULT_CONNECTION_TIMEOUT_MILLIS = 1000 * 30;
|
||||||
|
|
||||||
std::string get_default_ringdb_path()
|
std::string get_default_ringdb_path(cryptonote::network_type nettype)
|
||||||
{
|
{
|
||||||
boost::filesystem::path dir = tools::get_default_data_dir();
|
boost::filesystem::path dir = tools::get_default_data_dir();
|
||||||
// remove .bitmonero, replace with .shared-ringdb
|
// remove .bitmonero, replace with .shared-ringdb
|
||||||
dir = dir.remove_filename();
|
dir = dir.remove_filename();
|
||||||
dir /= ".shared-ringdb";
|
dir /= ".shared-ringdb";
|
||||||
|
if (nettype == cryptonote::TESTNET)
|
||||||
|
dir /= "testnet";
|
||||||
|
else if (nettype == cryptonote::STAGENET)
|
||||||
|
dir /= "stagenet";
|
||||||
return dir.string();
|
return dir.string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -599,7 +603,7 @@ bool WalletImpl::open(const std::string &path, const std::string &password)
|
||||||
// Rebuilding wallet cache, using refresh height from .keys file
|
// Rebuilding wallet cache, using refresh height from .keys file
|
||||||
m_rebuildWalletCache = true;
|
m_rebuildWalletCache = true;
|
||||||
}
|
}
|
||||||
m_wallet->set_ring_database(get_default_ringdb_path());
|
m_wallet->set_ring_database(get_default_ringdb_path(m_wallet->nettype()));
|
||||||
m_wallet->load(path, password);
|
m_wallet->load(path, password);
|
||||||
|
|
||||||
m_password = password;
|
m_password = password;
|
||||||
|
|
|
@ -141,13 +141,15 @@ struct options {
|
||||||
const command_line::arg_descriptor<bool> testnet = {"testnet", tools::wallet2::tr("For testnet. Daemon must also be launched with --testnet flag"), false};
|
const command_line::arg_descriptor<bool> testnet = {"testnet", tools::wallet2::tr("For testnet. Daemon must also be launched with --testnet flag"), false};
|
||||||
const command_line::arg_descriptor<bool> stagenet = {"stagenet", tools::wallet2::tr("For stagenet. Daemon must also be launched with --stagenet flag"), false};
|
const command_line::arg_descriptor<bool> stagenet = {"stagenet", tools::wallet2::tr("For stagenet. Daemon must also be launched with --stagenet flag"), false};
|
||||||
const command_line::arg_descriptor<bool> restricted = {"restricted-rpc", tools::wallet2::tr("Restricts to view-only commands"), false};
|
const command_line::arg_descriptor<bool> restricted = {"restricted-rpc", tools::wallet2::tr("Restricts to view-only commands"), false};
|
||||||
const command_line::arg_descriptor<std::string, false, true> shared_ringdb_dir = {
|
const command_line::arg_descriptor<std::string, false, true, 2> shared_ringdb_dir = {
|
||||||
"shared-ringdb-dir", tools::wallet2::tr("Set shared ring database path"),
|
"shared-ringdb-dir", tools::wallet2::tr("Set shared ring database path"),
|
||||||
get_default_ringdb_path(),
|
get_default_ringdb_path(),
|
||||||
testnet,
|
{{ &testnet, &stagenet }},
|
||||||
[](bool testnet, bool defaulted, std::string val)->std::string {
|
[](std::array<bool, 2> testnet_stagenet, bool defaulted, std::string val)->std::string {
|
||||||
if (testnet)
|
if (testnet_stagenet[0])
|
||||||
return (boost::filesystem::path(val) / "testnet").string();
|
return (boost::filesystem::path(val) / "testnet").string();
|
||||||
|
else if (testnet_stagenet[1])
|
||||||
|
return (boost::filesystem::path(val) / "stagenet").string();
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue