From db564efe0b35b036205778225bfe3557f24a70a5 Mon Sep 17 00:00:00 2001 From: selsta Date: Wed, 23 Jun 2021 20:43:19 +0200 Subject: wallet_api: fix typo in exportKeyImages --- src/wallet/api/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wallet') diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index b2ffce229..ff10eb519 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1178,7 +1178,7 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) try { - if (!m_wallet->export_key_images(filename), all) + if (!m_wallet->export_key_images(filename, all)) { setStatusError(tr("failed to save file ") + filename); return false; -- cgit v1.2.3 From 76824bf827e06a1b20847c65f1c4fbdabb0c79f7 Mon Sep 17 00:00:00 2001 From: Alex Opie Date: Fri, 22 Jan 2021 11:38:18 +1300 Subject: Stop adding more outputs than bulletproof allows If more outputs are requested, they are split across multiple transactions. #7322 --- src/wallet/wallet2.cpp | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'src/wallet') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 642777797..61c2b705b 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -9768,13 +9768,18 @@ std::vector wallet2::create_transactions_2(std::vector::iterator i; i = std::find_if(dsts.begin(), dsts.end(), [&](const cryptonote::tx_destination_entry &d) { return !memcmp (&d.addr, &de.addr, sizeof(de.addr)); }); if (i == dsts.end()) { + if (dsts.size() >= max_dsts) + return false; dsts.push_back(de); i = dsts.end() - 1; i->amount = 0; @@ -9787,12 +9792,15 @@ std::vector wallet2::create_transactions_2(std::vector " + std::to_string(dsts.size())); if (original_output_index == dsts.size()) { + if (dsts.size() >= max_dsts) + return false; dsts.push_back(de); dsts.back().amount = 0; } THROW_WALLET_EXCEPTION_IF(memcmp(&dsts[original_output_index].addr, &de.addr, sizeof(de.addr)), error::wallet_internal_error, "Mismatched destination address"); dsts[original_output_index].amount += amount; } + return true; } }; std::vector txes; @@ -10062,6 +10070,7 @@ std::vector wallet2::create_transactions_2(std::vector wallet2::create_transactions_2(std::vector 0 && !dsts.empty() && estimate_tx_weight(use_rct, tx.selected_transfers.size(), fake_outs_count, tx.dsts.size()+1, extra.size(), bulletproof, clsag) < TX_WEIGHT_TARGET(upper_transaction_weight_limit)) { + if (!out_slots_exhausted && available_amount > 0 && !dsts.empty() && estimate_tx_weight(use_rct, tx.selected_transfers.size(), fake_outs_count, tx.dsts.size()+1, extra.size(), bulletproof, clsag) < TX_WEIGHT_TARGET(upper_transaction_weight_limit)) { // we can partially fill that destination LOG_PRINT_L2("We can partially pay " << get_account_address_as_str(m_nettype, dsts[0].is_subaddress, dsts[0].addr) << " for " << print_money(available_amount) << "/" << print_money(dsts[0].amount)); - tx.add(dsts[0], available_amount, original_output_index, m_merge_destinations); - dsts[0].amount -= available_amount; - available_amount = 0; + if (tx.add(dsts[0], available_amount, original_output_index, m_merge_destinations, BULLETPROOF_MAX_OUTPUTS-1)) + { + dsts[0].amount -= available_amount; + available_amount = 0; + } + else + { + LOG_PRINT_L2("Didn't pay: ran out of output slots"); + out_slots_exhausted = true; + } } } @@ -10095,8 +10116,15 @@ std::vector wallet2::create_transactions_2(std::vector Date: Fri, 4 Jun 2021 18:59:33 +0200 Subject: wallet_api: getPassword --- src/wallet/api/wallet.cpp | 5 +++++ src/wallet/api/wallet.h | 1 + src/wallet/api/wallet2_api.h | 1 + 3 files changed, 7 insertions(+) (limited to 'src/wallet') diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index ff10eb519..94edba213 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -839,6 +839,11 @@ bool WalletImpl::setPassword(const std::string &password) return status() == Status_Ok; } +const std::string& WalletImpl::getPassword() const +{ + return m_password; +} + bool WalletImpl::setDevicePin(const std::string &pin) { clearStatus(); diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index ce2d7d7e4..b53548951 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -89,6 +89,7 @@ public: std::string errorString() const override; void statusWithErrorString(int& status, std::string& errorString) const override; bool setPassword(const std::string &password) override; + const std::string& getPassword() const override; bool setDevicePin(const std::string &password) override; bool setDevicePassphrase(const std::string &password) override; std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const override; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index e34332734..35516b35d 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -456,6 +456,7 @@ struct Wallet //! returns both error and error string atomically. suggested to use in instead of status() and errorString() virtual void statusWithErrorString(int& status, std::string& errorString) const = 0; virtual bool setPassword(const std::string &password) = 0; + virtual const std::string& getPassword() const = 0; virtual bool setDevicePin(const std::string &pin) { (void)pin; return false; }; virtual bool setDevicePassphrase(const std::string &passphrase) { (void)passphrase; return false; }; virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const = 0; -- cgit v1.2.3 From 94bad34c26c8da8e727dfb991f01ebb0cb12c014 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 13 Jul 2021 19:01:55 +0200 Subject: wallet2: Don't auto lock device on process parsed blocks --- src/wallet/wallet2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/wallet') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 61c2b705b..d5befdaaf 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2734,9 +2734,8 @@ void wallet2::process_parsed_blocks(uint64_t start_height, const std::vector hwdev_lock(hwdev); for (auto &iod: slot.primary) gender(iod); for (auto &iod: slot.additional) -- cgit v1.2.3