diff options
author | MarcoFalke <falke.marco@gmail.com> | 2015-10-25 02:47:04 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2015-11-03 08:53:37 +0100 |
commit | abd8b768ee889f28b3d2bc209307a9867a973556 (patch) | |
tree | 85c5e1d4a31b2f61e53e2d9372afbb71fa1ca819 /src/wallet | |
parent | 46f74379b86be982b121bcb8c3cfe07fa80bffd0 (diff) |
[qt] Properly display required fee instead of minTxFee
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet.cpp | 9 | ||||
-rw-r--r-- | src/wallet/wallet.h | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 3f2d5a05f6..8c0dad2381 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2120,6 +2120,11 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) return true; } +CAmount CWallet::GetRequiredFee(unsigned int nTxBytes) +{ + return std::max(minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes)); +} + CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool) { // payTxFee is user-set "I want to pay this much" @@ -2131,9 +2136,9 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge if (nFeeNeeded == 0) nFeeNeeded = pool.estimateFee(nConfirmTarget).GetFee(nTxBytes); // ... unless we don't have enough mempool data, in which case fall - // back to a hard-coded fee + // back to the required fee if (nFeeNeeded == 0) - nFeeNeeded = minTxFee.GetFee(nTxBytes); + nFeeNeeded = GetRequiredFee(nTxBytes); // prevent user from paying a non-sense fee (like 1 satoshi): 0 < fee < minRelayFee if (nFeeNeeded < ::minRelayTxFee.GetFee(nTxBytes)) nFeeNeeded = ::minRelayTxFee.GetFee(nTxBytes); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 34e98cfb81..22fe08670f 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -628,7 +628,16 @@ public: bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); static CFeeRate minTxFee; + /** + * Estimate the minimum fee considering user set parameters + * and the required fee + */ static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool); + /** + * Return the minimum required fee taking into account the + * floating relay fee and user set minimum transaction fee + */ + static CAmount GetRequiredFee(unsigned int nTxBytes); bool NewKeyPool(); bool TopUpKeyPool(unsigned int kpSize = 0); |