Skip to content

Commit 05fa823

Browse files
committed
wallet: Add BIP125 comment for MAXINT-1/-2 behavior
1 parent 152f45b commit 05fa823

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/wallet/wallet.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,6 +2358,12 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
23582358
//
23592359
// Note how the sequence number is set to non-maxint so that
23602360
// the nLockTime set above actually works.
2361+
//
2362+
// BIP125 defines opt-in RBF as any nSequence < maxint-1, so
2363+
// we use the highest possible value in that range (maxint-2)
2364+
// to avoid conflicting with other possible uses of nSequence,
2365+
// and in the spirit of "smallest posible change from prior
2366+
// behavior."
23612367
BOOST_FOREACH(const PAIRTYPE(const CWalletTx*,unsigned int)& coin, setCoins)
23622368
txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second,CScript(),
23632369
std::numeric_limits<unsigned int>::max() - (fOptIntoFullRbf ? 2 : 1)));

0 commit comments

Comments
 (0)