diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-10-30 10:49:22 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-10-30 10:49:22 +0000 |
commit | 1f9e6a46d8887c4c29803ff5e639d1cf192865de (patch) | |
tree | be8ee40af53578ef9444a1a7b29ba4e59f541b8e /src/wallet | |
parent | Merge pull request #1270 (diff) | |
download | monero-1f9e6a46d8887c4c29803ff5e639d1cf192865de.tar.xz |
wallet: print tx overview on submit_transfer too
This is on the potentially compromised wallet, but still guards
against stupid mistakes.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 8 | ||||
-rw-r--r-- | src/wallet/wallet2.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a02c2e4e5..889dacae0 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2678,7 +2678,7 @@ bool wallet2::sign_tx(const std::string &unsigned_filename, const std::string &s return epee::file_io_utils::save_string_to_file(signed_filename, std::string(SIGNED_TX_PREFIX) + s); } //---------------------------------------------------------------------------------------------------- -bool wallet2::load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx) +bool wallet2::load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func) { std::string s; boost::system::error_code errcode; @@ -2709,6 +2709,12 @@ bool wallet2::load_tx(const std::string &signed_filename, std::vector<tools::wal LOG_PRINT_L0("Loaded signed tx data from binary: " << signed_txs.ptx.size() << " transactions"); for (auto &ptx: signed_txs.ptx) LOG_PRINT_L0(cryptonote::obj_to_json_str(ptx.tx)); + if (accept_func && !accept_func(signed_txs)) + { + LOG_PRINT_L1("Transactions rejected by callback"); + return false; + } + ptx = signed_txs.ptx; return true; diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 39a2a37f1..b6312dd21 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -357,7 +357,7 @@ namespace tools void commit_tx(std::vector<pending_tx>& ptx_vector); bool save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename); bool sign_tx(const std::string &unsigned_filename, const std::string &signed_filename, std::function<bool(const unsigned_tx_set&)> accept_func = NULL); - bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx); + bool load_tx(const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &ptx, std::function<bool(const signed_tx_set&)> accept_func = NULL); std::vector<pending_tx> create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t> extra, bool trusted_daemon); std::vector<wallet2::pending_tx> create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t> extra, bool trusted_daemon); std::vector<wallet2::pending_tx> create_transactions_all(const cryptonote::account_public_address &address, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t> extra, bool trusted_daemon); |