mirror of
https://github.com/monero-project/monero.git
synced 2026-01-13 13:27:34 -08:00
wallet: encrypt (un)signed tx, also optionally save unencrypted raw tx hexstr
This commit is contained in:
@@ -3432,12 +3432,18 @@ bool simple_wallet::sign_transfer(const std::vector<std::string> &args_)
|
||||
fail_msg_writer() << tr("This is a watch only wallet");
|
||||
return true;
|
||||
}
|
||||
if (args_.size() > 1 || (args_.size() == 1 && args_[0] != "export"))
|
||||
{
|
||||
fail_msg_writer() << tr("usage: sign_transfer [export]");
|
||||
return true;
|
||||
}
|
||||
if (m_wallet->ask_password() && !get_and_verify_password()) { return true; }
|
||||
const bool export_raw = args_.size() == 1;
|
||||
|
||||
std::vector<tools::wallet2::pending_tx> ptx;
|
||||
try
|
||||
{
|
||||
bool r = m_wallet->sign_tx("unsigned_monero_tx", "signed_monero_tx", ptx, [&](const tools::wallet2::unsigned_tx_set &tx){ return accept_loaded_tx(tx); });
|
||||
bool r = m_wallet->sign_tx("unsigned_monero_tx", "signed_monero_tx", ptx, [&](const tools::wallet2::unsigned_tx_set &tx){ return accept_loaded_tx(tx); }, export_raw);
|
||||
if (!r)
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to sign transaction");
|
||||
@@ -3458,6 +3464,17 @@ bool simple_wallet::sign_transfer(const std::vector<std::string> &args_)
|
||||
txids_as_text += epee::string_tools::pod_to_hex(get_transaction_hash(t.tx));
|
||||
}
|
||||
success_msg_writer(true) << tr("Transaction successfully signed to file ") << "signed_monero_tx" << ", txid " << txids_as_text;
|
||||
if (export_raw)
|
||||
{
|
||||
std::string rawfiles_as_text;
|
||||
for (size_t i = 0; i < ptx.size(); ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
rawfiles_as_text += ", ";
|
||||
rawfiles_as_text += "signed_monero_tx_raw" + (ptx.size() == 1 ? "" : ("_" + std::to_string(i)));
|
||||
}
|
||||
success_msg_writer(true) << tr("Transaction raw hex data exported to ") << rawfiles_as_text;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user