Skip to content

Commit f1ff148

Browse files
authored
Fix bip69 vs change position issue (#3063)
* Fix bip69 vs change position issue * Drop `setbip69enabled` rpc
1 parent 3a79b67 commit f1ff148

File tree

5 files changed

+2
-33
lines changed

5 files changed

+2
-33
lines changed

src/rpc/client.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
148148
{ "prioritisetransaction", 1, "fee_delta" },
149149
{ "setban", 2, "bantime" },
150150
{ "setban", 3, "absolute" },
151-
{ "setbip69enabled", 0, "enabled" },
152151
{ "setnetworkactive", 0, "state" },
153152
{ "setprivatesendrounds", 0, "rounds" },
154153
{ "setprivatesendamount", 0, "amount" },

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,27 +3064,6 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
30643064
return result;
30653065
}
30663066

3067-
UniValue setbip69enabled(const JSONRPCRequest& request)
3068-
{
3069-
CWallet* const pwallet = GetWalletForJSONRPCRequest(request);
3070-
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
3071-
return NullUniValue;
3072-
3073-
if (request.fHelp || request.params.size() != 1)
3074-
throw std::runtime_error(
3075-
"setbip69enabled enable\n"
3076-
"\nEnable/Disable BIP69 input/output sorting (-regtest only)\n"
3077-
"\nArguments:\n"
3078-
"1. enable (bool, required) true or false"
3079-
);
3080-
if (Params().NetworkIDString() != CBaseChainParams::REGTEST)
3081-
throw std::runtime_error("setbip69enabled for regression testing (-regtest mode) only");
3082-
3083-
bBIP69Enabled = request.params[0].get_bool();
3084-
3085-
return NullUniValue;
3086-
}
3087-
30883067
#if ENABLE_MINER
30893068
UniValue generate(const JSONRPCRequest& request)
30903069
{
@@ -3208,8 +3187,6 @@ static const CRPCCommand commands[] =
32083187
{ "hidden", "instantsendtoaddress", &instantsendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount"} },
32093188
{ "wallet", "dumphdinfo", &dumphdinfo, true, {} },
32103189
{ "wallet", "importelectrumwallet", &importelectrumwallet, true, {"filename", "index"} },
3211-
3212-
{ "hidden", "setbip69enabled", &setbip69enabled, true, {} },
32133190
};
32143191

32153192
void RegisterWalletRPCCommands(CRPCTable &t)

src/wallet/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ std::vector<CWalletRef> vpwallets;
5050
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
5151
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
5252
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
53-
bool bBIP69Enabled = true;
5453

5554
const char * DEFAULT_WALLET_DAT = "wallet.dat";
5655

@@ -3760,7 +3759,8 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
37603759
txNew.vin.push_back(txin);
37613760
}
37623761

3763-
if (bBIP69Enabled) {
3762+
// If no specific change position was requested, apply BIP69
3763+
if (nChangePosRequest == -1) {
37643764
std::sort(txNew.vin.begin(), txNew.vin.end(), CompareInputBIP69());
37653765
std::sort(vecTxDSInTmp.begin(), vecTxDSInTmp.end(), CompareInputBIP69());
37663766
std::sort(txNew.vout.begin(), txNew.vout.end(), CompareOutputBIP69());

src/wallet/wallet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ extern std::vector<CWalletRef> vpwallets;
4343
extern CFeeRate payTxFee;
4444
extern unsigned int nTxConfirmTarget;
4545
extern bool bSpendZeroConfChange;
46-
extern bool bBIP69Enabled;
4746

4847
static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
4948
//! -paytxfee default

test/functional/fundrawtransaction.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,6 @@ def run_test(self):
667667
# Make sure there is exactly one input so coin selection can't skew the result
668668
assert_equal(len(self.nodes[3].listunspent(1)), 1)
669669

670-
# Disable BIP69 sorting of inputs and outputs
671-
self.nodes[3].setbip69enabled(False)
672-
673670
inputs = []
674671
outputs = {self.nodes[2].getnewaddress(): 1}
675672
rawtx = self.nodes[3].createrawtransaction(inputs, outputs)
@@ -732,8 +729,5 @@ def run_test(self):
732729
# the total subtracted from the outputs is equal to the fee
733730
assert_equal(share[0] + share[2] + share[3], result[0]['fee'])
734731

735-
# Reenable BIP69 sorting of inputs and outputs
736-
self.nodes[3].setbip69enabled(True)
737-
738732
if __name__ == '__main__':
739733
RawTransactionsTest().main()

0 commit comments

Comments
 (0)