mirror of
https://github.com/monero-project/monero.git
synced 2024-12-15 12:56:33 +02:00
simplewallet: reorganize SCOPED_WALLET_UNLOCK a bit more
Followup on #4555
This commit is contained in:
parent
963d247154
commit
5d4f3df887
@ -580,12 +580,12 @@ std::string simple_wallet::get_command_usage(const std::vector<std::string> &arg
|
|||||||
|
|
||||||
bool simple_wallet::viewkey(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
bool simple_wallet::viewkey(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||||
{
|
{
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
// don't log
|
// don't log
|
||||||
PAUSE_READLINE();
|
PAUSE_READLINE();
|
||||||
if (m_wallet->key_on_device()) {
|
if (m_wallet->key_on_device()) {
|
||||||
std::cout << "secret: On device. Not available" << std::endl;
|
std::cout << "secret: On device. Not available" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
printf("secret: ");
|
printf("secret: ");
|
||||||
print_secret_key(m_wallet->get_account().get_keys().m_view_secret_key);
|
print_secret_key(m_wallet->get_account().get_keys().m_view_secret_key);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@ -602,12 +602,12 @@ bool simple_wallet::spendkey(const std::vector<std::string> &args/* = std::vecto
|
|||||||
fail_msg_writer() << tr("wallet is watch-only and has no spend key");
|
fail_msg_writer() << tr("wallet is watch-only and has no spend key");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
// don't log
|
// don't log
|
||||||
PAUSE_READLINE();
|
PAUSE_READLINE();
|
||||||
if (m_wallet->key_on_device()) {
|
if (m_wallet->key_on_device()) {
|
||||||
std::cout << "secret: On device. Not available" << std::endl;
|
std::cout << "secret: On device. Not available" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
printf("secret: ");
|
printf("secret: ");
|
||||||
print_secret_key(m_wallet->get_account().get_keys().m_spend_secret_key);
|
print_secret_key(m_wallet->get_account().get_keys().m_spend_secret_key);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@ -634,8 +634,6 @@ bool simple_wallet::print_seed(bool encrypted)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
|
|
||||||
multisig = m_wallet->multisig(&ready);
|
multisig = m_wallet->multisig(&ready);
|
||||||
if (multisig)
|
if (multisig)
|
||||||
{
|
{
|
||||||
@ -645,7 +643,10 @@ bool simple_wallet::print_seed(bool encrypted)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!m_wallet->is_deterministic())
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
|
if (!multisig && !m_wallet->is_deterministic())
|
||||||
{
|
{
|
||||||
fail_msg_writer() << tr("wallet is non-deterministic and has no seed");
|
fail_msg_writer() << tr("wallet is non-deterministic and has no seed");
|
||||||
return true;
|
return true;
|
||||||
@ -1077,11 +1078,12 @@ bool simple_wallet::export_multisig(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
|
|
||||||
const std::string filename = args[0];
|
const std::string filename = args[0];
|
||||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cryptonote::blobdata ciphertext = m_wallet->export_multisig();
|
cryptonote::blobdata ciphertext = m_wallet->export_multisig();
|
||||||
@ -1129,8 +1131,6 @@ bool simple_wallet::import_multisig(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
|
|
||||||
std::vector<cryptonote::blobdata> info;
|
std::vector<cryptonote::blobdata> info;
|
||||||
for (size_t n = 0; n < args.size(); ++n)
|
for (size_t n = 0; n < args.size(); ++n)
|
||||||
{
|
{
|
||||||
@ -1145,6 +1145,8 @@ bool simple_wallet::import_multisig(const std::vector<std::string> &args)
|
|||||||
info.push_back(std::move(data));
|
info.push_back(std::move(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
// all read and parsed, actually import
|
// all read and parsed, actually import
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1282,11 +1284,11 @@ bool simple_wallet::submit_multisig(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
|
|
||||||
if (!try_connect_to_daemon())
|
if (!try_connect_to_daemon())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
std::string filename = args[0];
|
std::string filename = args[0];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1350,11 +1352,12 @@ bool simple_wallet::export_raw_multisig(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
|
|
||||||
std::string filename = args[0];
|
std::string filename = args[0];
|
||||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tools::wallet2::multisig_tx_set txs;
|
tools::wallet2::multisig_tx_set txs;
|
||||||
@ -5577,7 +5580,6 @@ bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<st
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
|
bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
|
||||||
{
|
{
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
if (!try_connect_to_daemon())
|
if (!try_connect_to_daemon())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -5725,6 +5727,8 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// figure out what tx will be necessary
|
// figure out what tx will be necessary
|
||||||
@ -7658,7 +7662,6 @@ bool simple_wallet::sign(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
std::string filename = args[0];
|
std::string filename = args[0];
|
||||||
std::string data;
|
std::string data;
|
||||||
bool r = epee::file_io_utils::load_file_to_string(filename, data);
|
bool r = epee::file_io_utils::load_file_to_string(filename, data);
|
||||||
@ -7667,6 +7670,9 @@ bool simple_wallet::sign(const std::vector<std::string> &args)
|
|||||||
fail_msg_writer() << tr("failed to read file ") << filename;
|
fail_msg_writer() << tr("failed to read file ") << filename;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
std::string signature = m_wallet->sign(data);
|
std::string signature = m_wallet->sign(data);
|
||||||
success_msg_writer() << signature;
|
success_msg_writer() << signature;
|
||||||
return true;
|
return true;
|
||||||
@ -7728,11 +7734,12 @@ bool simple_wallet::export_key_images(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
std::string filename = args[0];
|
std::string filename = args[0];
|
||||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!m_wallet->export_key_images(filename))
|
if (!m_wallet->export_key_images(filename))
|
||||||
@ -7832,11 +7839,12 @@ bool simple_wallet::export_outputs(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_WALLET_UNLOCK();
|
|
||||||
std::string filename = args[0];
|
std::string filename = args[0];
|
||||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
SCOPED_WALLET_UNLOCK();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::string data = m_wallet->export_outputs_to_str();
|
std::string data = m_wallet->export_outputs_to_str();
|
||||||
|
Loading…
Reference in New Issue
Block a user