@ -2786,11 +2786,19 @@ UniValue bumpfee(const JSONRPCRequest& request)
CFeeRate nOldFeeRate ( nOldFee , txSize ) ;
CFeeRate nOldFeeRate ( nOldFee , txSize ) ;
CAmount nNewFee ;
CAmount nNewFee ;
CFeeRate nNewFeeRate ;
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 ) {
if ( totalFee > 0 ) {
CAmount minTotalFee = nOldFeeRate . GetFee ( maxNewTxSize ) + : : incrementalRelayFee . GetFee ( maxNewTxSize ) ;
CAmount minTotalFee = nOldFeeRate . GetFee ( maxNewTxSize ) + : : incrementalRelayFee . GetFee ( maxNewTxSize ) ;
if ( totalFee < minTotalFee ) {
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 ;
nNewFee = totalFee ;
nNewFeeRate = CFeeRate ( totalFee , maxNewTxSize ) ;
nNewFeeRate = CFeeRate ( totalFee , maxNewTxSize ) ;
@ -2806,9 +2814,9 @@ UniValue bumpfee(const JSONRPCRequest& request)
nNewFeeRate = CFeeRate ( nNewFee , maxNewTxSize ) ;
nNewFeeRate = CFeeRate ( nNewFee , maxNewTxSize ) ;
// n ew fee rate must be at least old rate + minimum incremental relay rate
// N ew fee rate must be at least old rate + minimum incremental relay rate
if ( nNewFeeRate . GetFeePerK ( ) < nOldFeeRate . GetFeePerK ( ) + : : i ncrementalRelayFee. GetFeePerK ( ) ) {
if ( nNewFeeRate . GetFeePerK ( ) < nOldFeeRate . GetFeePerK ( ) + walletI ncrementalRelayFee. GetFeePerK ( ) ) {
nNewFeeRate = CFeeRate ( nOldFeeRate . GetFeePerK ( ) + : : i ncrementalRelayFee. GetFeePerK ( ) ) ;
nNewFeeRate = CFeeRate ( nOldFeeRate . GetFeePerK ( ) + walletI ncrementalRelayFee. GetFeePerK ( ) ) ;
nNewFee = nNewFeeRate . GetFee ( maxNewTxSize ) ;
nNewFee = nNewFeeRate . GetFee ( maxNewTxSize ) ;
}
}
}
}