From a199d8716337a84c6ef5d4bd5300d1dedf69c1ce Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Thu, 5 Dec 2019 21:19:16 +0100 Subject: [PATCH] added parameter on open wallet for inital tx count --- src/gui/qt-daemon/application/daemon_backend.cpp | 4 ++-- src/gui/qt-daemon/application/daemon_backend.h | 2 +- src/gui/qt-daemon/application/mainwindow.cpp | 2 +- src/gui/qt-daemon/application/view_iface.h | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/qt-daemon/application/daemon_backend.cpp b/src/gui/qt-daemon/application/daemon_backend.cpp index 0bddba44..b4bd319d 100644 --- a/src/gui/qt-daemon/application/daemon_backend.cpp +++ b/src/gui/qt-daemon/application/daemon_backend.cpp @@ -655,7 +655,7 @@ std::string daemon_backend::get_my_offers(const bc_services::core_offers_filter& return API_RETURN_CODE_OK; } -std::string daemon_backend::open_wallet(const std::wstring& path, const std::string& password, view::open_wallet_response& owr) +std::string daemon_backend::open_wallet(const std::wstring& path, const std::string& password, uint64_t txs_to_return, view::open_wallet_response& owr) { std::shared_ptr w(new tools::wallet2()); owr.wallet_id = m_wallet_id_counter++; @@ -677,7 +677,7 @@ std::string daemon_backend::open_wallet(const std::wstring& path, const std::str try { w->load(path, password); - w->get_recent_transfers_history(owr.recent_history.history, 0, 100, owr.recent_history.total_history_items); + w->get_recent_transfers_history(owr.recent_history.history, 0, txs_to_return, owr.recent_history.total_history_items); //w->get_unconfirmed_transfers(owr.recent_history.unconfirmed); w->get_unconfirmed_transfers(owr.recent_history.history); //workaround for missed fee diff --git a/src/gui/qt-daemon/application/daemon_backend.h b/src/gui/qt-daemon/application/daemon_backend.h index f73b3a5f..ec610739 100644 --- a/src/gui/qt-daemon/application/daemon_backend.h +++ b/src/gui/qt-daemon/application/daemon_backend.h @@ -84,7 +84,7 @@ public: bool start(); bool stop(); bool send_stop_signal(); - std::string open_wallet(const std::wstring& path, const std::string& password, view::open_wallet_response& owr); + std::string open_wallet(const std::wstring& path, const std::string& password, uint64_t txs_to_return, view::open_wallet_response& owr); std::string generate_wallet(const std::wstring& path, const std::string& password, view::open_wallet_response& owr); std::string restore_wallet(const std::wstring& path, const std::string& password, const std::string& restore_key, view::open_wallet_response& owr); std::string run_wallet(uint64_t wallet_id); diff --git a/src/gui/qt-daemon/application/mainwindow.cpp b/src/gui/qt-daemon/application/mainwindow.cpp index 8d5da58c..e918a835 100644 --- a/src/gui/qt-daemon/application/mainwindow.cpp +++ b/src/gui/qt-daemon/application/mainwindow.cpp @@ -1602,7 +1602,7 @@ QString MainWindow::open_wallet(const QString& param) //return que_call2("open_wallet", param, [this](const view::open_wallet_request& owd, view::api_response& ar){ PREPARE_ARG_FROM_JSON(view::open_wallet_request, owd); PREPARE_RESPONSE(view::open_wallet_response, ar); - ar.error_code = m_backend.open_wallet(epee::string_encoding::utf8_to_wstring(owd.path), owd.pass, ar.response_data); + ar.error_code = m_backend.open_wallet(epee::string_encoding::utf8_to_wstring(owd.path), owd.pass, owd.txs_to_return, ar.response_data); return MAKE_RESPONSE(ar); CATCH_ENTRY_FAIL_API_RESPONCE(); } diff --git a/src/gui/qt-daemon/application/view_iface.h b/src/gui/qt-daemon/application/view_iface.h index 85c1b08e..d50cec72 100644 --- a/src/gui/qt-daemon/application/view_iface.h +++ b/src/gui/qt-daemon/application/view_iface.h @@ -373,10 +373,12 @@ public: { std::string pass; std::string path; + uint64_t txs_to_return; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(pass) KV_SERIALIZE(path) + KV_SERIALIZE(txs_to_return) END_KV_SERIALIZE_MAP() };