@ -2724,7 +2724,10 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
if ( coinControl & & coinControl - > nConfirmTarget > 0 )
currentConfirmationTarget = coinControl - > nConfirmTarget ;
CAmount nFeeNeeded = GetMinimumFee ( nBytes , currentConfirmationTarget , : : mempool , : : feeEstimator , & feeCalc , false /* ignoreGlobalPayTxFee */ ) ;
// Allow to override the default fee estimate mode over the CoinControl instance
bool conservative_estimate = CalculateEstimateType ( coinControl ? coinControl - > m_fee_mode : FeeEstimateMode : : UNSET ) ;
CAmount nFeeNeeded = GetMinimumFee ( nBytes , currentConfirmationTarget , : : mempool , : : feeEstimator , & feeCalc , false /* ignoreGlobalPayTxFee */ , conservative_estimate ) ;
if ( coinControl & & coinControl - > fOverrideFeeRate )
nFeeNeeded = coinControl - > nFeeRate . GetFee ( nBytes ) ;
@ -2905,13 +2908,13 @@ 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 , const CBlockPolicyEstimator & estimator , FeeCalculation * feeCalc , bool ignoreGlobalPayTxFee )
CAmount CWallet : : GetMinimumFee ( unsigned int nTxBytes , unsigned int nConfirmTarget , const CTxMemPool & pool , const CBlockPolicyEstimator & estimator , FeeCalculation * feeCalc , bool ignoreGlobalPayTxFee , bool conservative_estimate )
{
// payTxFee is the user-set global for desired feerate
CAmount nFeeNeeded = payTxFee . GetFee ( nTxBytes ) ;
// User didn't set: use -txconfirmtarget to estimate...
if ( nFeeNeeded = = 0 | | ignoreGlobalPayTxFee ) {
nFeeNeeded = estimator . estimateSmartFee ( nConfirmTarget , feeCalc , pool , tru e) . GetFee ( nTxBytes ) ;
nFeeNeeded = estimator . estimateSmartFee ( nConfirmTarget , feeCalc , pool , conservative_estimat e) . GetFee ( nTxBytes ) ;
// ... unless we don't have enough mempool data for estimatefee, then use fallbackFee
if ( nFeeNeeded = = 0 ) {
nFeeNeeded = fallbackFee . GetFee ( nTxBytes ) ;
@ -4154,3 +4157,14 @@ bool CMerkleTx::AcceptToMemoryPool(const CAmount& nAbsurdFee, CValidationState&
{
return : : AcceptToMemoryPool ( mempool , state , tx , true , NULL , NULL , false , nAbsurdFee ) ;
}
bool CalculateEstimateType ( FeeEstimateMode mode ) {
switch ( mode ) {
case FeeEstimateMode : : UNSET :
case FeeEstimateMode : : CONSERVATIVE :
return true ;
case FeeEstimateMode : : ECONOMICAL :
return false ;
}
return true ;
}