mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Introduce WALLET_INCREMENTAL_RELAY_FEE
Have wallet's default bump value be higher than the default incrementalRelayFee to future proof against changes to incremental relay fee. Only applies when not setting the fee rate directly.
This commit is contained in:
parent
e8021ec919
commit
0c0c63f70a
@ -2786,11 +2786,19 @@ UniValue bumpfee(const JSONRPCRequest& request)
|
||||
CFeeRate nOldFeeRate(nOldFee, txSize);
|
||||
CAmount nNewFee;
|
||||
CFeeRate nNewFeeRate;
|
||||
// The wallet uses a conservative WALLET_INCREMENTAL_RELAY_FEE value to
|
||||
// future proof against changes to network wide policy for incremental relay
|
||||
// fee that our node may not be aware of.
|
||||
CFeeRate walletIncrementalRelayFee = CFeeRate(WALLET_INCREMENTAL_RELAY_FEE);
|
||||
if (::incrementalRelayFee > walletIncrementalRelayFee) {
|
||||
walletIncrementalRelayFee = ::incrementalRelayFee;
|
||||
}
|
||||
|
||||
if (totalFee > 0) {
|
||||
CAmount minTotalFee = nOldFeeRate.GetFee(maxNewTxSize) + ::incrementalRelayFee.GetFee(maxNewTxSize);
|
||||
if (totalFee < minTotalFee) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid totalFee, must be at least %s (oldFee %s + relayFee %s)", FormatMoney(minTotalFee), nOldFeeRate.GetFee(maxNewTxSize), ::incrementalRelayFee.GetFee(maxNewTxSize)));
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Insufficient totalFee, must be at least %s (oldFee %s + incrementalFee %s)",
|
||||
FormatMoney(minTotalFee), FormatMoney(nOldFeeRate.GetFee(maxNewTxSize)), FormatMoney(::incrementalRelayFee.GetFee(maxNewTxSize))));
|
||||
}
|
||||
nNewFee = totalFee;
|
||||
nNewFeeRate = CFeeRate(totalFee, maxNewTxSize);
|
||||
@ -2806,9 +2814,9 @@ UniValue bumpfee(const JSONRPCRequest& request)
|
||||
|
||||
nNewFeeRate = CFeeRate(nNewFee, maxNewTxSize);
|
||||
|
||||
// new fee rate must be at least old rate + minimum incremental relay rate
|
||||
if (nNewFeeRate.GetFeePerK() < nOldFeeRate.GetFeePerK() + ::incrementalRelayFee.GetFeePerK()) {
|
||||
nNewFeeRate = CFeeRate(nOldFeeRate.GetFeePerK() + ::incrementalRelayFee.GetFeePerK());
|
||||
// New fee rate must be at least old rate + minimum incremental relay rate
|
||||
if (nNewFeeRate.GetFeePerK() < nOldFeeRate.GetFeePerK() + walletIncrementalRelayFee.GetFeePerK()) {
|
||||
nNewFeeRate = CFeeRate(nOldFeeRate.GetFeePerK() + walletIncrementalRelayFee.GetFeePerK());
|
||||
nNewFee = nNewFeeRate.GetFee(maxNewTxSize);
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,8 @@ static const CAmount DEFAULT_TRANSACTION_FEE = 0;
|
||||
static const CAmount DEFAULT_FALLBACK_FEE = 20000;
|
||||
//! -mintxfee default
|
||||
static const CAmount DEFAULT_TRANSACTION_MINFEE = 1000;
|
||||
//! minimum recommended increment for BIP 125 replacement txs
|
||||
static const CAmount WALLET_INCREMENTAL_RELAY_FEE = 5000;
|
||||
//! target minimum change amount
|
||||
static const CAmount MIN_CHANGE = CENT;
|
||||
//! final minimum change amount after paying for fees
|
||||
|
Loading…
Reference in New Issue
Block a user