diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:37:52 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-04-16 22:37:52 +0200 |
commit | 96696d1e75c202b7770cfd5a2a44b5b79e380a34 (patch) | |
tree | cef4168e4aadc9f25853f6d4bebf52f04bb166e0 /src/wallet | |
parent | Merge pull request #5414 (diff) | |
parent | wallet_rpc_server: add a all flag to export_outputs (diff) | |
download | monero-96696d1e75c202b7770cfd5a2a44b5b79e380a34.tar.xz |
Merge pull request #5418
374f388d wallet_rpc_server: add a all flag to export_outputs (moneromooo-monero)
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 11 | ||||
-rw-r--r-- | src/wallet/wallet2.h | 4 | ||||
-rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 2 | ||||
-rw-r--r-- | src/wallet/wallet_rpc_server_commands_defs.h | 5 |
4 files changed, 13 insertions, 9 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index b288994a5..204b8810f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -12032,14 +12032,15 @@ void wallet2::import_blockchain(const std::tuple<size_t, crypto::hash, std::vect m_last_block_reward = cryptonote::get_outs_money_amount(genesis.miner_tx); } //---------------------------------------------------------------------------------------------------- -std::pair<size_t, std::vector<tools::wallet2::transfer_details>> wallet2::export_outputs() const +std::pair<size_t, std::vector<tools::wallet2::transfer_details>> wallet2::export_outputs(bool all) const { PERF_TIMER(export_outputs); std::vector<tools::wallet2::transfer_details> outs; size_t offset = 0; - while (offset < m_transfers.size() && (m_transfers[offset].m_key_image_known && !m_transfers[offset].m_key_image_request)) - ++offset; + if (!all) + while (offset < m_transfers.size() && (m_transfers[offset].m_key_image_known && !m_transfers[offset].m_key_image_request)) + ++offset; outs.reserve(m_transfers.size() - offset); for (size_t n = offset; n < m_transfers.size(); ++n) @@ -12052,13 +12053,13 @@ std::pair<size_t, std::vector<tools::wallet2::transfer_details>> wallet2::export return std::make_pair(offset, outs); } //---------------------------------------------------------------------------------------------------- -std::string wallet2::export_outputs_to_str() const +std::string wallet2::export_outputs_to_str(bool all) const { PERF_TIMER(export_outputs_to_str); std::stringstream oss; boost::archive::portable_binary_oarchive ar(oss); - const auto& outputs = export_outputs(); + const auto& outputs = export_outputs(all); ar << outputs; std::string magic(OUTPUT_EXPORT_FILE_MAGIC, strlen(OUTPUT_EXPORT_FILE_MAGIC)); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 39380c9df..032d2a663 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -1139,8 +1139,8 @@ namespace tools bool verify_with_public_key(const std::string &data, const crypto::public_key &public_key, const std::string &signature) const; // Import/Export wallet data - std::pair<size_t, std::vector<tools::wallet2::transfer_details>> export_outputs() const; - std::string export_outputs_to_str() const; + std::pair<size_t, std::vector<tools::wallet2::transfer_details>> export_outputs(bool all = false) const; + std::string export_outputs_to_str(bool all = false) const; size_t import_outputs(const std::pair<size_t, std::vector<tools::wallet2::transfer_details>> &outputs); size_t import_outputs_from_str(const std::string &outputs_st); payment_container export_payments() const; diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 71c64d3c1..9a7e15df2 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -2581,7 +2581,7 @@ namespace tools try { - res.outputs_data_hex = epee::string_tools::buff_to_hex_nodelimer(m_wallet->export_outputs_to_str()); + res.outputs_data_hex = epee::string_tools::buff_to_hex_nodelimer(m_wallet->export_outputs_to_str(req.all)); } catch (const std::exception &e) { diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h index bb360ae01..9c84c5ef4 100644 --- a/src/wallet/wallet_rpc_server_commands_defs.h +++ b/src/wallet/wallet_rpc_server_commands_defs.h @@ -47,7 +47,7 @@ // advance which version they will stop working with // Don't go over 32767 for any of these #define WALLET_RPC_VERSION_MAJOR 1 -#define WALLET_RPC_VERSION_MINOR 9 +#define WALLET_RPC_VERSION_MINOR 10 #define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor)) #define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR) namespace tools @@ -1626,7 +1626,10 @@ namespace wallet_rpc { struct request_t { + bool all; + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(all) END_KV_SERIALIZE_MAP() }; typedef epee::misc_utils::struct_init<request_t> request; |