mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-13 05:12:34 -03:00
Allow to opt-into RBF when creating a transaction
This commit is contained in:
parent
82274c02ed
commit
568c05a591
2 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
#define BITCOIN_WALLET_COINCONTROL_H
|
#define BITCOIN_WALLET_COINCONTROL_H
|
||||||
|
|
||||||
#include "primitives/transaction.h"
|
#include "primitives/transaction.h"
|
||||||
|
#include "wallet/wallet.h"
|
||||||
|
|
||||||
/** Coin Control Features. */
|
/** Coin Control Features. */
|
||||||
class CCoinControl
|
class CCoinControl
|
||||||
|
@ -24,6 +25,8 @@ public:
|
||||||
CFeeRate nFeeRate;
|
CFeeRate nFeeRate;
|
||||||
//! Override the default confirmation target, 0 = use default
|
//! Override the default confirmation target, 0 = use default
|
||||||
int nConfirmTarget;
|
int nConfirmTarget;
|
||||||
|
//! Signal BIP-125 replace by fee.
|
||||||
|
bool signalRbf;
|
||||||
|
|
||||||
CCoinControl()
|
CCoinControl()
|
||||||
{
|
{
|
||||||
|
@ -40,6 +43,7 @@ public:
|
||||||
nFeeRate = CFeeRate(0);
|
nFeeRate = CFeeRate(0);
|
||||||
fOverrideFeeRate = false;
|
fOverrideFeeRate = false;
|
||||||
nConfirmTarget = 0;
|
nConfirmTarget = 0;
|
||||||
|
signalRbf = fWalletRbf;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasSelected() const
|
bool HasSelected() const
|
||||||
|
|
|
@ -2566,9 +2566,10 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||||
// to avoid conflicting with other possible uses of nSequence,
|
// to avoid conflicting with other possible uses of nSequence,
|
||||||
// and in the spirit of "smallest posible change from prior
|
// and in the spirit of "smallest posible change from prior
|
||||||
// behavior."
|
// behavior."
|
||||||
|
bool rbf = coinControl ? coinControl->signalRbf : fWalletRbf;
|
||||||
for (const auto& coin : setCoins)
|
for (const auto& coin : setCoins)
|
||||||
txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second,CScript(),
|
txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second,CScript(),
|
||||||
std::numeric_limits<unsigned int>::max() - (fWalletRbf ? 2 : 1)));
|
std::numeric_limits<unsigned int>::max() - (rbf ? 2 : 1)));
|
||||||
|
|
||||||
// Fill in dummy signatures for fee calculation.
|
// Fill in dummy signatures for fee calculation.
|
||||||
int nIn = 0;
|
int nIn = 0;
|
||||||
|
|
Loading…
Reference in a new issue