[qt] Properly display required fee instead of minTxFee

Zcash: Only includes non-QT parts
This commit is contained in:
MarcoFalke 2015-10-25 02:47:04 +02:00 committed by Jack Grigg
parent e3bdf82dc2
commit e255b2c278
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
2 changed files with 16 additions and 2 deletions

View File

@ -3636,6 +3636,11 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, boost::optional<CReserveKey&>
return true; 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) CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool)
{ {
// payTxFee is user-set "I want to pay this much" // payTxFee is user-set "I want to pay this much"
@ -3647,9 +3652,9 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
if (nFeeNeeded == 0) if (nFeeNeeded == 0)
nFeeNeeded = pool.estimateFee(nConfirmTarget).GetFee(nTxBytes); nFeeNeeded = pool.estimateFee(nConfirmTarget).GetFee(nTxBytes);
// ... unless we don't have enough mempool data, in which case fall // ... 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) if (nFeeNeeded == 0)
nFeeNeeded = minTxFee.GetFee(nTxBytes); nFeeNeeded = GetRequiredFee(nTxBytes);
// prevent user from paying a non-sense fee (like 1 satoshi): 0 < fee < minRelayFee // prevent user from paying a non-sense fee (like 1 satoshi): 0 < fee < minRelayFee
if (nFeeNeeded < ::minRelayTxFee.GetFee(nTxBytes)) if (nFeeNeeded < ::minRelayTxFee.GetFee(nTxBytes))
nFeeNeeded = ::minRelayTxFee.GetFee(nTxBytes); nFeeNeeded = ::minRelayTxFee.GetFee(nTxBytes);

View File

@ -1176,7 +1176,16 @@ public:
bool CommitTransaction(CWalletTx& wtxNew, boost::optional<CReserveKey&> reservekey); bool CommitTransaction(CWalletTx& wtxNew, boost::optional<CReserveKey&> reservekey);
static CFeeRate minTxFee; 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); 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 NewKeyPool();
bool TopUpKeyPool(unsigned int kpSize = 0); bool TopUpKeyPool(unsigned int kpSize = 0);