From 374f388de21b253c165792a893cdb4f158cdc24b Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 10 Apr 2019 10:37:34 +0000 Subject: wallet_rpc_server: add a all flag to export_outputs if we don't want to export new outputs only --- src/wallet/wallet2.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/wallet/wallet2.cpp') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 54fbd9ca8..87e159e6d 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -11931,14 +11931,15 @@ void wallet2::import_blockchain(const std::tuple> wallet2::export_outputs() const +std::pair> wallet2::export_outputs(bool all) const { PERF_TIMER(export_outputs); std::vector 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) @@ -11951,13 +11952,13 @@ std::pair> 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)); -- cgit v1.2.3