diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-01-13 14:34:55 -0500 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-01-13 14:34:55 -0500 |
commit | faa33fc32629a893b8a75833d8d53440586e1d88 (patch) | |
tree | 905eede208e862ebc930d04ca999bd041e6eac6e /src/wallet/wallet2.cpp | |
parent | Merge pull request #1540 (diff) | |
parent | Wallet api: Update trustedDaemon when daemon is changed (diff) | |
download | monero-faa33fc32629a893b8a75833d8d53440586e1d88.tar.xz |
Merge pull request #1541
0d3918e1 Wallet api: Update trustedDaemon when daemon is changed (Jaquee)
dbb838f4 GUI cold signing (Jaquee)
afb85a02 Wallet API: functions for supporting/creating view only wallets (Jaquee)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 639c2c5fc..b57ea9273 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3017,7 +3017,7 @@ bool wallet2::save_tx(const std::vector<pending_tx>& ptx_vector, const std::stri return epee::file_io_utils::save_string_to_file(filename, std::string(UNSIGNED_TX_PREFIX) + oss.str()); } //---------------------------------------------------------------------------------------------------- -bool wallet2::sign_tx(const std::string &unsigned_filename, const std::string &signed_filename, std::vector<wallet2::pending_tx> &txs, std::function<bool(const unsigned_tx_set&)> accept_func) +bool wallet2::load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) { std::string s; boost::system::error_code errcode; @@ -3038,7 +3038,6 @@ bool wallet2::sign_tx(const std::string &unsigned_filename, const std::string &s LOG_PRINT_L0("Bad magic from " << unsigned_filename); return false; } - unsigned_tx_set exported_txs; s = s.substr(magiclen); try { @@ -3053,12 +3052,26 @@ bool wallet2::sign_tx(const std::string &unsigned_filename, const std::string &s } LOG_PRINT_L1("Loaded tx unsigned data from binary: " << exported_txs.txes.size() << " transactions"); + return true; +} +//---------------------------------------------------------------------------------------------------- +bool wallet2::sign_tx(const std::string &unsigned_filename, const std::string &signed_filename, std::vector<wallet2::pending_tx> &txs, std::function<bool(const unsigned_tx_set&)> accept_func) +{ + unsigned_tx_set exported_txs; + if(!load_unsigned_tx(unsigned_filename, exported_txs)) + return false; + if (accept_func && !accept_func(exported_txs)) { LOG_PRINT_L1("Transactions rejected by callback"); return false; } + return sign_tx(exported_txs, signed_filename, txs); +} +//---------------------------------------------------------------------------------------------------- +bool wallet2::sign_tx(unsigned_tx_set &exported_txs, const std::string &signed_filename, std::vector<wallet2::pending_tx> &txs) +{ import_outputs(exported_txs.transfers); // sign the transactions |