mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Add more clear interface for CoinControl.h regarding individual feerate
This commit is contained in:
parent
3b35e4896b
commit
04eaa90958
@ -18,7 +18,9 @@ public:
|
|||||||
bool fAllowWatchOnly;
|
bool fAllowWatchOnly;
|
||||||
//! Minimum absolute fee (not per kilobyte)
|
//! Minimum absolute fee (not per kilobyte)
|
||||||
CAmount nMinimumTotalFee;
|
CAmount nMinimumTotalFee;
|
||||||
//! Feerate to use (0 = estimate fee with payTxFee fallback)
|
//! Override estimated feerate
|
||||||
|
bool fOverrideFeeRate;
|
||||||
|
//! Feerate to use if overrideFeeRate is true
|
||||||
CFeeRate nFeeRate;
|
CFeeRate nFeeRate;
|
||||||
|
|
||||||
CCoinControl()
|
CCoinControl()
|
||||||
@ -34,6 +36,7 @@ public:
|
|||||||
setSelected.clear();
|
setSelected.clear();
|
||||||
nMinimumTotalFee = 0;
|
nMinimumTotalFee = 0;
|
||||||
nFeeRate = CFeeRate(0);
|
nFeeRate = CFeeRate(0);
|
||||||
|
fOverrideFeeRate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasSelected() const
|
bool HasSelected() const
|
||||||
|
@ -2486,6 +2486,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
bool includeWatching = false;
|
bool includeWatching = false;
|
||||||
bool lockUnspents = false;
|
bool lockUnspents = false;
|
||||||
CFeeRate feeRate = CFeeRate(0);
|
CFeeRate feeRate = CFeeRate(0);
|
||||||
|
bool overrideEstimatedFeerate = false;
|
||||||
|
|
||||||
if (params.size() > 1) {
|
if (params.size() > 1) {
|
||||||
if (params[1].type() == UniValue::VBOOL) {
|
if (params[1].type() == UniValue::VBOOL) {
|
||||||
@ -2518,7 +2519,10 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
lockUnspents = options["lockUnspents"].get_bool();
|
lockUnspents = options["lockUnspents"].get_bool();
|
||||||
|
|
||||||
if (options.exists("feeRate"))
|
if (options.exists("feeRate"))
|
||||||
|
{
|
||||||
feeRate = CFeeRate(options["feeRate"].get_real());
|
feeRate = CFeeRate(options["feeRate"].get_real());
|
||||||
|
overrideEstimatedFeerate = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2537,7 +2541,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
CAmount nFeeOut;
|
CAmount nFeeOut;
|
||||||
string strFailReason;
|
string strFailReason;
|
||||||
|
|
||||||
if(!pwalletMain->FundTransaction(tx, nFeeOut, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, changeAddress))
|
if(!pwalletMain->FundTransaction(tx, nFeeOut, overrideEstimatedFeerate, feeRate, changePosition, strFailReason, includeWatching, lockUnspents, changeAddress))
|
||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, strFailReason);
|
throw JSONRPCError(RPC_INTERNAL_ERROR, strFailReason);
|
||||||
|
|
||||||
UniValue result(UniValue::VOBJ);
|
UniValue result(UniValue::VOBJ);
|
||||||
|
@ -1918,7 +1918,7 @@ bool CWallet::SelectCoins(const vector<COutput>& vAvailableCoins, const CAmount&
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, const CFeeRate& specificFeeRate, int& nChangePosInOut, std::string& strFailReason, bool includeWatching, bool lockUnspents, const CTxDestination& destChange)
|
bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, bool overrideEstimatedFeeRate, const CFeeRate& specificFeeRate, int& nChangePosInOut, std::string& strFailReason, bool includeWatching, bool lockUnspents, const CTxDestination& destChange)
|
||||||
{
|
{
|
||||||
vector<CRecipient> vecSend;
|
vector<CRecipient> vecSend;
|
||||||
|
|
||||||
@ -1933,6 +1933,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, const C
|
|||||||
coinControl.destChange = destChange;
|
coinControl.destChange = destChange;
|
||||||
coinControl.fAllowOtherInputs = true;
|
coinControl.fAllowOtherInputs = true;
|
||||||
coinControl.fAllowWatchOnly = includeWatching;
|
coinControl.fAllowWatchOnly = includeWatching;
|
||||||
|
coinControl.fOverrideFeeRate = overrideEstimatedFeeRate;
|
||||||
coinControl.nFeeRate = specificFeeRate;
|
coinControl.nFeeRate = specificFeeRate;
|
||||||
|
|
||||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||||
@ -2244,7 +2245,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
|
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
|
||||||
nFeeNeeded = coinControl->nMinimumTotalFee;
|
nFeeNeeded = coinControl->nMinimumTotalFee;
|
||||||
}
|
}
|
||||||
if (coinControl && coinControl->nFeeRate > CFeeRate(0))
|
if (coinControl && coinControl->fOverrideFeeRate)
|
||||||
nFeeNeeded = coinControl->nFeeRate.GetFee(nBytes);
|
nFeeNeeded = coinControl->nFeeRate.GetFee(nBytes);
|
||||||
|
|
||||||
// If we made it here and we aren't even able to meet the relay fee on the next pass, give up
|
// If we made it here and we aren't even able to meet the relay fee on the next pass, give up
|
||||||
|
@ -740,7 +740,7 @@ public:
|
|||||||
* Insert additional inputs into the transaction by
|
* Insert additional inputs into the transaction by
|
||||||
* calling CreateTransaction();
|
* calling CreateTransaction();
|
||||||
*/
|
*/
|
||||||
bool FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, const CFeeRate& specificFeeRate, int& nChangePosInOut, std::string& strFailReason, bool includeWatching, bool lockUnspents, const CTxDestination& destChange = CNoDestination());
|
bool FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, bool overrideEstimatedFeeRate, const CFeeRate& specificFeeRate, int& nChangePosInOut, std::string& strFailReason, bool includeWatching, bool lockUnspents, const CTxDestination& destChange = CNoDestination());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new transaction paying the recipients with a set of coins
|
* Create a new transaction paying the recipients with a set of coins
|
||||||
|
Loading…
Reference in New Issue
Block a user