diff options
Diffstat (limited to 'src/wallet/api')
-rw-r--r-- | src/wallet/api/pending_transaction.cpp | 2 | ||||
-rw-r--r-- | src/wallet/api/transaction_history.cpp | 1 | ||||
-rw-r--r-- | src/wallet/api/transaction_info.cpp | 6 | ||||
-rw-r--r-- | src/wallet/api/transaction_info.h | 2 | ||||
-rw-r--r-- | src/wallet/api/unsigned_transaction.cpp | 10 | ||||
-rw-r--r-- | src/wallet/api/wallet.cpp | 16 | ||||
-rw-r--r-- | src/wallet/api/wallet.h | 1 | ||||
-rw-r--r-- | src/wallet/api/wallet_manager.cpp | 4 | ||||
-rw-r--r-- | src/wallet/api/wallet_manager.h | 1 |
9 files changed, 30 insertions, 13 deletions
diff --git a/src/wallet/api/pending_transaction.cpp b/src/wallet/api/pending_transaction.cpp index 9798d66c6..c98a599e7 100644 --- a/src/wallet/api/pending_transaction.cpp +++ b/src/wallet/api/pending_transaction.cpp @@ -102,6 +102,7 @@ bool PendingTransactionImpl::commit(const std::string &filename, bool overwrite) } // Commit tx else { + m_wallet.pauseRefresh(); while (!m_pending_tx.empty()) { auto & ptx = m_pending_tx.back(); m_wallet.m_wallet->commit_tx(ptx); @@ -133,6 +134,7 @@ bool PendingTransactionImpl::commit(const std::string &filename, bool overwrite) m_status = Status_Error; } + m_wallet.startRefresh(); return m_status == Status_Ok; } diff --git a/src/wallet/api/transaction_history.cpp b/src/wallet/api/transaction_history.cpp index 85f2b05ce..23d3905b2 100644 --- a/src/wallet/api/transaction_history.cpp +++ b/src/wallet/api/transaction_history.cpp @@ -132,6 +132,7 @@ void TransactionHistoryImpl::refresh() ti->m_blockheight = pd.m_block_height; ti->m_timestamp = pd.m_timestamp; ti->m_confirmations = wallet_height - pd.m_block_height; + ti->m_unlock_time = pd.m_unlock_time; m_history.push_back(ti); /* output.insert(std::make_pair(pd.m_block_height, std::make_pair(true, (boost::format("%20.20s %s %s %s") diff --git a/src/wallet/api/transaction_info.cpp b/src/wallet/api/transaction_info.cpp index 79a8fe9b5..171272265 100644 --- a/src/wallet/api/transaction_info.cpp +++ b/src/wallet/api/transaction_info.cpp @@ -50,6 +50,7 @@ TransactionInfoImpl::TransactionInfoImpl() , m_blockheight(0) , m_timestamp(0) , m_confirmations(0) + , m_unlock_time(0) { } @@ -115,6 +116,11 @@ uint64_t TransactionInfoImpl::confirmations() const return m_confirmations; } +uint64_t TransactionInfoImpl::unlockTime() const +{ + return m_unlock_time; +} + } // namespace namespace Bitmonero = Monero; diff --git a/src/wallet/api/transaction_info.h b/src/wallet/api/transaction_info.h index 16fa5da7a..ee56b859f 100644 --- a/src/wallet/api/transaction_info.h +++ b/src/wallet/api/transaction_info.h @@ -56,6 +56,7 @@ public: virtual std::string paymentId() const; virtual const std::vector<Transfer> &transfers() const; virtual uint64_t confirmations() const; + virtual uint64_t unlockTime() const; private: int m_direction; @@ -69,6 +70,7 @@ private: std::string m_paymentid; std::vector<Transfer> m_transfers; uint64_t m_confirmations; + uint64_t m_unlock_time; friend class TransactionHistoryImpl; diff --git a/src/wallet/api/unsigned_transaction.cpp b/src/wallet/api/unsigned_transaction.cpp index 1d9ef5d7c..961bd772a 100644 --- a/src/wallet/api/unsigned_transaction.cpp +++ b/src/wallet/api/unsigned_transaction.cpp @@ -101,7 +101,7 @@ bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_nu { // gather info to ask the user uint64_t amount = 0, amount_to_dests = 0, change = 0; - size_t min_mixin = ~0; + size_t min_ring_size = ~0; std::unordered_map<std::string, uint64_t> dests; const std::string wallet_address = m_wallet.m_wallet->get_account().get_public_address_str(m_wallet.m_wallet->testnet()); int first_known_non_zero_change_index = -1; @@ -111,9 +111,9 @@ bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_nu for (size_t s = 0; s < cd.sources.size(); ++s) { amount += cd.sources[s].amount; - size_t mixin = cd.sources[s].outputs.size() - 1; - if (mixin < min_mixin) - min_mixin = mixin; + size_t ring_size = cd.sources[s].outputs.size(); + if (ring_size < min_ring_size) + min_ring_size = ring_size; } for (size_t d = 0; d < cd.splitted_dsts.size(); ++d) { @@ -178,7 +178,7 @@ bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_nu else change_string += tr("no change"); uint64_t fee = amount - amount_to_dests; - m_confirmationMessage = (boost::format(tr("Loaded %lu transactions, for %s, fee %s, %s, %s, with min mixin %lu. %s")) % (unsigned long)get_num_txes() % cryptonote::print_money(amount) % cryptonote::print_money(fee) % dest_string % change_string % (unsigned long)min_mixin % extra_message).str(); + m_confirmationMessage = (boost::format(tr("Loaded %lu transactions, for %s, fee %s, %s, %s, with min ring size %lu. %s")) % (unsigned long)get_num_txes() % cryptonote::print_money(amount) % cryptonote::print_money(fee) % dest_string % change_string % (unsigned long)min_ring_size % extra_message).str(); return true; } diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 6a0e1727c..a2bb44cfe 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -99,7 +99,7 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback } } - virtual void on_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) + virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount) { std::string tx_hash = epee::string_tools::pod_to_hex(txid); @@ -114,7 +114,7 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback } } - virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) + virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount) { std::string tx_hash = epee::string_tools::pod_to_hex(txid); @@ -129,8 +129,8 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback } } - virtual void on_money_spent(uint64_t height, const crypto::hash &txid, uint64_t amount, - const cryptonote::transaction& spend_tx) + virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, + uint64_t amount, const cryptonote::transaction& spend_tx) { // TODO; std::string tx_hash = epee::string_tools::pod_to_hex(txid); @@ -1009,9 +1009,9 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const } catch (const tools::error::not_enough_outs_to_mix& e) { std::ostringstream writer; - writer << tr("not enough outputs for specified mixin_count") << " = " << e.mixin_count() << ":"; + writer << tr("not enough outputs for specified ring size") << " = " << (e.mixin_count() + 1) << ":"; for (const std::pair<uint64_t, uint64_t> outs_for_amount : e.scanty_outs()) { - writer << "\n" << tr("output amount") << " = " << print_money(outs_for_amount.first) << ", " << tr("found outputs to mix") << " = " << outs_for_amount.second; + writer << "\n" << tr("output amount") << " = " << print_money(outs_for_amount.first) << ", " << tr("found outputs to use") << " = " << outs_for_amount.second; } m_errorString = writer.str(); m_status = Status_Error; @@ -1103,9 +1103,9 @@ PendingTransaction *WalletImpl::createSweepUnmixableTransaction() } catch (const tools::error::not_enough_outs_to_mix& e) { std::ostringstream writer; - writer << tr("not enough outputs for specified mixin_count") << " = " << e.mixin_count() << ":"; + writer << tr("not enough outputs for specified ring size") << " = " << (e.mixin_count() + 1) << ":"; for (const std::pair<uint64_t, uint64_t> outs_for_amount : e.scanty_outs()) { - writer << "\n" << tr("output amount") << " = " << print_money(outs_for_amount.first) << ", " << tr("found outputs to mix") << " = " << outs_for_amount.second; + writer << "\n" << tr("output amount") << " = " << print_money(outs_for_amount.first) << ", " << tr("found outputs to use") << " = " << outs_for_amount.second; } m_errorString = writer.str(); m_status = Status_Error; diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index e9e2cc580..07b0f063b 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -98,6 +98,7 @@ public: void setAutoRefreshInterval(int millis); int autoRefreshInterval() const; void setRefreshFromBlockHeight(uint64_t refresh_from_block_height); + uint64_t getRefreshFromBlockHeight() const { return m_wallet->get_refresh_from_block_height(); }; void setRecoveringFromSeed(bool recoveringFromSeed); bool watchOnly() const; bool rescanSpent(); diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp index b2f947972..a23533530 100644 --- a/src/wallet/api/wallet_manager.cpp +++ b/src/wallet/api/wallet_manager.cpp @@ -125,6 +125,10 @@ bool WalletManagerImpl::walletExists(const std::string &path) return false; } +bool WalletManagerImpl::verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool watch_only) const +{ + return tools::wallet2::verify_password(keys_file_name, password, watch_only); +} std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path) { diff --git a/src/wallet/api/wallet_manager.h b/src/wallet/api/wallet_manager.h index 033e8108f..aa6ea439e 100644 --- a/src/wallet/api/wallet_manager.h +++ b/src/wallet/api/wallet_manager.h @@ -50,6 +50,7 @@ public: const std::string &spendKeyString = ""); virtual bool closeWallet(Wallet *wallet); bool walletExists(const std::string &path); + bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool watch_only) const; std::vector<std::string> findWallets(const std::string &path); std::string errorString() const; void setDaemonAddress(const std::string &address); |