mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 10:37:37 -07: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>()*/)
|
||||
{
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
// don't log
|
||||
PAUSE_READLINE();
|
||||
if (m_wallet->key_on_device()) {
|
||||
std::cout << "secret: On device. Not available" << std::endl;
|
||||
} else {
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
printf("secret: ");
|
||||
print_secret_key(m_wallet->get_account().get_keys().m_view_secret_key);
|
||||
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");
|
||||
return true;
|
||||
}
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
// don't log
|
||||
PAUSE_READLINE();
|
||||
if (m_wallet->key_on_device()) {
|
||||
std::cout << "secret: On device. Not available" << std::endl;
|
||||
} else {
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
printf("secret: ");
|
||||
print_secret_key(m_wallet->get_account().get_keys().m_spend_secret_key);
|
||||
putchar('\n');
|
||||
@ -634,8 +634,6 @@ bool simple_wallet::print_seed(bool encrypted)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
multisig = m_wallet->multisig(&ready);
|
||||
if (multisig)
|
||||
{
|
||||
@ -645,7 +643,10 @@ bool simple_wallet::print_seed(bool encrypted)
|
||||
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");
|
||||
return true;
|
||||
@ -1077,11 +1078,12 @@ bool simple_wallet::export_multisig(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
const std::string filename = args[0];
|
||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||
return true;
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
try
|
||||
{
|
||||
cryptonote::blobdata ciphertext = m_wallet->export_multisig();
|
||||
@ -1129,8 +1131,6 @@ bool simple_wallet::import_multisig(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
std::vector<cryptonote::blobdata> info;
|
||||
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));
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
// all read and parsed, actually import
|
||||
try
|
||||
{
|
||||
@ -1282,11 +1284,11 @@ bool simple_wallet::submit_multisig(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
if (!try_connect_to_daemon())
|
||||
return true;
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
std::string filename = args[0];
|
||||
try
|
||||
{
|
||||
@ -1350,11 +1352,12 @@ bool simple_wallet::export_raw_multisig(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
std::string filename = args[0];
|
||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||
return true;
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
try
|
||||
{
|
||||
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_)
|
||||
{
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
if (!try_connect_to_daemon())
|
||||
return true;
|
||||
|
||||
@ -5725,6 +5727,8 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
|
||||
}
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
try
|
||||
{
|
||||
// figure out what tx will be necessary
|
||||
@ -7658,7 +7662,6 @@ bool simple_wallet::sign(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
std::string filename = args[0];
|
||||
std::string 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;
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
std::string signature = m_wallet->sign(data);
|
||||
success_msg_writer() << signature;
|
||||
return true;
|
||||
@ -7728,11 +7734,12 @@ bool simple_wallet::export_key_images(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
std::string filename = args[0];
|
||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||
return true;
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
try
|
||||
{
|
||||
if (!m_wallet->export_key_images(filename))
|
||||
@ -7832,11 +7839,12 @@ bool simple_wallet::export_outputs(const std::vector<std::string> &args)
|
||||
return true;
|
||||
}
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
std::string filename = args[0];
|
||||
if (m_wallet->confirm_export_overwrite() && !check_file_overwrite(filename))
|
||||
return true;
|
||||
|
||||
SCOPED_WALLET_UNLOCK();
|
||||
|
||||
try
|
||||
{
|
||||
std::string data = m_wallet->export_outputs_to_str();
|
||||
|
Loading…
Reference in New Issue
Block a user