Backport of #15911 for 0.18 branch.
The original PR changed rawtransaction_util.cpp
, whereas the backport changes rawtransaction.cpp
to avoid having to also backport #15638.
525@@ -528,7 +526,11 @@ static UniValue createrawtransaction(const JSONRPCRequest& request)
526 }, true
527 );
528
529- CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], request.params[3]);
530+ bool rbf = false;
531+ if (!request.params[3].isNull()) {
532+ rbf = request.params[3].isTrue();
I have verified that the code changes here match those in the original PR (haven’t actually re-reviewed the changes though, just verified the backport)
a678e06874e0004cd026e1969c27ecfc643ac289
re-utACK 576580fe8a063f21c0e903af1cf8f85cd6cb71d7
Only change was indentation fix
ACK 576580fe8a063f21c0e903af1cf8f85cd6cb71d7
Signature:
0-----BEGIN PGP SIGNED MESSAGE-----
1Hash: SHA512
2
3ACK 576580fe8a063f21c0e903af1cf8f85cd6cb71d7
4-----BEGIN PGP SIGNATURE-----
5
6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
7pUi90wwAwVZA8P1MHIw8biLLtDV+osnhJQ8yQCXAZG2ED4snoCbV5s2SczbTgksT
8BWzEiCEQqf5s0lF1cgnCjkaYpIidpZ55O7iVSYTFnvlAd8Aw6cAH0Xe0V9VF+WhG
90tW3GBTIaOX4ZEfwMD0nSxdAorL1UWYt3HgDjaGNlZBWzScdFlTHzLb7LXKQqLL2
10CprrQo/n2Ryp+riKB4998YserFpoudeHRcYzTR4aq0bmgfYEVtXZuxhlcz75BdQh
11nw2Ehas82qqOtszuDUbvvOkZguwUfwEtoAxH3yUxsGUUwISOPmn2ekdE8u4WRxos
12lgemrveGSKjPmEEhWKSETR97lTe6XLAjiaPtiClxAQSmBOhtuY0LqZpmhkh9B2Ru
13R6QBnF+iZDAc7e0OQ7Bqug273Swhub5YbDS2qs2YL63EO+SKo528SNcznJRHBI8a
14ZBdKWDxqMJysj5LkrW4oeIH312vcMK1wbBjiF5IZpmalShvHHux7oxPVFUpTEOfu
15ywn7IU9C
16=3lWE
17-----END PGP SIGNATURE-----
Timestamp of file with hash f5a11e9d65e3f6cfd270f092131edbd8b4b33243c1a93c5ebd8c3244f41517df -
The code itself was the same when I did the backport, but those were the commit differences (via range-diff):
01: ee950ec465 ! 1: 1057254270 [rpc] walletcreatefundedpsbt: use wallet default RBF
1 @@ -2,6 +2,9 @@
2
3 [rpc] walletcreatefundedpsbt: use wallet default RBF
4
5 + Github-Pull: [#15911](/bitcoin-bitcoin/15911/)
6 + Rebased-From: 4fcb698bc2bb74171cd3a14b94f9882d8e19e9fb
7 +
8 diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
9 --- a/src/rpc/rawtransaction.cpp
10 +++ b/src/rpc/rawtransaction.cpp
11 @@ -84,6 +87,15 @@
12 --- a/src/wallet/rpcwallet.cpp
13 +++ b/src/wallet/rpcwallet.cpp
14 @@
15 + {"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
16 + },
17 + },
18 +- {"replaceable", RPCArg::Type::BOOL, /* default */ "false", "Marks this transaction as BIP125 replaceable.\n"
19 ++ {"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Marks this transaction as BIP125 replaceable.\n"
20 + " Allows this transaction to be replaced by a transaction with higher fees"},
21 + {"conf_target", RPCArg::Type::NUM, /* default */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"},
22 + {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
23 +@@
24
25 CAmount fee;
26 int change_position;
27 @@ -119,12 +131,12 @@
28 block_height = self.nodes[0].getblockcount()
29 unspent = self.nodes[0].listunspent()[0]
30 - psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}], block_height+2, {"replaceable":True}, False)
31 -+ psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}], block_height+2, {"replaceable":False}, False)
32 ++ psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}], block_height+2, {"replaceable": False}, False)
33 decoded_psbt = self.nodes[0].decodepsbt(psbtx_info["psbt"])
34 for tx_in, psbt_in in zip(decoded_psbt["tx"]["vin"], decoded_psbt["inputs"]):
35 - assert_equal(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
36 - assert "bip32_derivs" not in psbt_in
37 -+ assert(tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE)
38 ++ assert tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE
39 + assert "bip32_derivs" not in psbt_in
40 assert_equal(decoded_psbt["tx"]["locktime"], block_height+2)
41
422: 0942a60c06 ! 2: 7ab99cf477 [doc] rpc: remove "fallback to" from RBF default help
43 @@ -2,6 +2,9 @@
44
45 [doc] rpc: remove "fallback to" from RBF default help
46
47 + Github-Pull: [#15911](/bitcoin-bitcoin/15911/)
48 + Rebased-From: 9ed062b5685eb6227d694572cb0f7bfbcc151b36
49 +
50 diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
51 --- a/src/wallet/rpcwallet.cpp
52 +++ b/src/wallet/rpcwallet.cpp
53 @@ -48,12 +51,3 @@
54 {"totalFee", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "Total fee (NOT feerate) to pay, in satoshis.\n"
55 " In rare cases, the actual fee paid might be slightly higher than the specified\n"
56 " totalFee if the tx change output has to be removed because it is too close to\n"
57 -@@
58 - {"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
59 - },
60 - },
61 -- {"replaceable", RPCArg::Type::BOOL, /* default */ "false", "Marks this transaction as BIP125 replaceable.\n"
62 -+ {"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Marks this transaction as BIP125 replaceable.\n"
63 - " Allows this transaction to be replaced by a transaction with higher fees"},
64 - {"conf_target", RPCArg::Type::NUM, /* default */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"},
65 - {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
663: 576580fe8a ! 3: 86bc93ec44 [test] walletcreatefundedpsbt: check RBF is disabled when -walletrbf=0
67 @@ -2,19 +2,13 @@
68
69 [test] walletcreatefundedpsbt: check RBF is disabled when -walletrbf=0
70
71 + Github-Pull: [#15911](/bitcoin-bitcoin/15911/)
72 + Rebased-From: d6b3640ac732f6f66a8cb6761084d1beecc8a876
73 +
74 diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
75 --- a/test/functional/rpc_psbt.py
76 +++ b/test/functional/rpc_psbt.py
77 @@
78 -
79 - from decimal import Decimal
80 - from test_framework.test_framework import BitcoinTestFramework
81 --from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes_bi, disconnect_nodes, find_output, sync_blocks
82 -+from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, connect_nodes_bi, disconnect_nodes, find_output, sync_blocks
83 -
84 - import json
85 - import os
86 -@@
87 self.num_nodes = 3
88 self.extra_args = [
89 ["-walletrbf=1"],
90 @@ -24,10 +18,10 @@
91 ]
92
93 @@
94 - psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}], block_height+2, {"replaceable":False}, False)
95 + psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid":unspent["txid"], "vout":unspent["vout"]}], [{self.nodes[2].getnewaddress():unspent["amount"]+1}], block_height+2, {"replaceable": False}, False)
96 decoded_psbt = self.nodes[0].decodepsbt(psbtx_info["psbt"])
97 for tx_in, psbt_in in zip(decoded_psbt["tx"]["vin"], decoded_psbt["inputs"]):
98 -- assert(tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE)
99 +- assert tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE
100 + assert_greater_than(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
101 assert "bip32_derivs" not in psbt_in
102 assert_equal(decoded_psbt["tx"]["locktime"], block_height+2)