Skip to content

Commit 568c05a

Browse files
jonasschnelliryanofsky
authored andcommitted
Allow to opt-into RBF when creating a transaction
1 parent 82274c0 commit 568c05a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/wallet/coincontrol.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define BITCOIN_WALLET_COINCONTROL_H
77

88
#include "primitives/transaction.h"
9+
#include "wallet/wallet.h"
910

1011
/** Coin Control Features. */
1112
class CCoinControl
@@ -24,6 +25,8 @@ class CCoinControl
2425
CFeeRate nFeeRate;
2526
//! Override the default confirmation target, 0 = use default
2627
int nConfirmTarget;
28+
//! Signal BIP-125 replace by fee.
29+
bool signalRbf;
2730

2831
CCoinControl()
2932
{
@@ -40,6 +43,7 @@ class CCoinControl
4043
nFeeRate = CFeeRate(0);
4144
fOverrideFeeRate = false;
4245
nConfirmTarget = 0;
46+
signalRbf = fWalletRbf;
4347
}
4448

4549
bool HasSelected() const

src/wallet/wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2566,9 +2566,10 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
25662566
// to avoid conflicting with other possible uses of nSequence,
25672567
// and in the spirit of "smallest posible change from prior
25682568
// behavior."
2569+
bool rbf = coinControl ? coinControl->signalRbf : fWalletRbf;
25692570
for (const auto& coin : setCoins)
25702571
txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second,CScript(),
2571-
std::numeric_limits<unsigned int>::max() - (fWalletRbf ? 2 : 1)));
2572+
std::numeric_limits<unsigned int>::max() - (rbf ? 2 : 1)));
25722573

25732574
// Fill in dummy signatures for fee calculation.
25742575
int nIn = 0;

0 commit comments

Comments
 (0)