aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-06-27 14:55:13 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-07-18 23:02:18 +0300
commit083380cb8f121190746195c45e6766f543b87d0f (patch)
tree6fc2c36587ce832ccfb9d3e18cace59c2a142669 /src/wallet
parentWallet::paymentIdValid (diff)
downloadmonero-083380cb8f121190746195c45e6766f543b87d0f.tar.xz
Transaction fee multiplier aka priority integraged
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/api/wallet.cpp8
-rw-r--r--src/wallet/api/wallet.h5
-rw-r--r--src/wallet/wallet2_api.h16
3 files changed, 25 insertions, 4 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 5a0642f30..3f2ea50bd 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -402,7 +402,9 @@ bool WalletImpl::refresh()
// - unconfirmed_transfer_details;
// - confirmed_transfer_details)
-PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const string &payment_id, uint64_t amount, uint32_t mixin_count)
+PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const string &payment_id, uint64_t amount, uint32_t mixin_count,
+ PendingTransaction::Priority priority)
+
{
clearStatus();
vector<cryptonote::tx_destination_entry> dsts;
@@ -464,8 +466,10 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const
//std::vector<tools::wallet2::pending_tx> ptx_vector;
try {
+ // priority called "fee_multiplied in terms of underlying wallet interface
transaction->m_pending_tx = m_wallet->create_transactions_2(dsts, fake_outs_count, 0 /* unlock_time */,
- 0 /* unused fee arg*/, extra, m_trustedDaemon);
+ static_cast<uint64_t>(priority),
+ extra, m_trustedDaemon);
} catch (const tools::error::daemon_busy&) {
// TODO: make it translatable with "tr"?
diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h
index 164aede1a..0896f51ee 100644
--- a/src/wallet/api/wallet.h
+++ b/src/wallet/api/wallet.h
@@ -71,8 +71,11 @@ public:
uint64_t balance() const;
uint64_t unlockedBalance() const;
bool refresh();
+
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
- uint64_t amount, uint32_t mixin_count);
+ uint64_t amount, uint32_t mixin_count,
+ PendingTransaction::Priority priority = PendingTransaction::Priority_Low);
+
virtual void disposeTransaction(PendingTransaction * t);
virtual TransactionHistory * history() const;
virtual void setListener(WalletListener * l);
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h
index fefdf98c4..fb3f9a648 100644
--- a/src/wallet/wallet2_api.h
+++ b/src/wallet/wallet2_api.h
@@ -50,6 +50,14 @@ struct PendingTransaction
Status_Ok,
Status_Error
};
+
+ enum Priority {
+ Priority_Low = 1,
+ Priority_Medium = 2,
+ Priority_High = 3,
+ Priority_Last
+ };
+
virtual ~PendingTransaction() = 0;
virtual int status() const = 0;
virtual std::string errorString() const = 0;
@@ -186,13 +194,19 @@ struct Wallet
* \param payment_id optional payment_id, can be empty string
* \param amount amount
* \param mixin_count mixin count. if 0 passed, wallet will use default value
+ * \param priority
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
* after object returned
*/
virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
- uint64_t amount, uint32_t mixin_count) = 0;
+ uint64_t amount, uint32_t mixin_count,
+ PendingTransaction::Priority = PendingTransaction::Priority_Low) = 0;
+ /*!
+ * \brief disposeTransaction - destroys transaction object
+ * \param t - pointer to the "PendingTransaction" object. Pointer is not valid after function returned;
+ */
virtual void disposeTransaction(PendingTransaction * t) = 0;
virtual TransactionHistory * history() const = 0;
virtual void setListener(WalletListener *) = 0;