diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-10-15 17:32:30 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-10-15 17:32:30 +0200 |
commit | d316b3d266f81e6e107d63fffb5dc28cdd4e36fa (patch) | |
tree | a731e13fcab8889efdab5240a1137dc5e898f894 /src/simplewallet | |
parent | Merge pull request #2552 (diff) | |
parent | wallet: encrypt (un)signed tx, also optionally save unencrypted raw tx hexstr (diff) | |
download | monero-d316b3d266f81e6e107d63fffb5dc28cdd4e36fa.tar.xz |
Merge pull request #2554
d74336d5 wallet: encrypt (un)signed tx, also optionally save unencrypted raw tx hexstr (stoffu)
Diffstat (limited to 'src/simplewallet')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 882f1f72a..bc503c73c 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -3540,12 +3540,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"); @@ -3566,6 +3572,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; } //---------------------------------------------------------------------------------------------------- |