aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2017-01-08 13:17:09 +0100
committerJaquee <jaquee.monero@gmail.com>2017-01-10 22:49:17 +0100
commitdbb838f4d0f197a97e5e6387ea9b175dbc59613b (patch)
tree43fbd55c02597f87f8ca1585eabb15a5f5c8fc84 /src/wallet/wallet2.cpp
parentWallet API: functions for supporting/creating view only wallets (diff)
downloadmonero-dbb838f4d0f197a97e5e6387ea9b175dbc59613b.tar.xz
GUI cold signing
fix conflict
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 1550787e5..8e7710842 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2970,7 +2970,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;
@@ -2991,7 +2991,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
{
@@ -3006,12 +3005,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