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();
nit: indentation
Fix
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
<details><summary>Show signature and timestamp</summary>
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK 576580fe8a063f21c0e903af1cf8f85cd6cb71d7
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUi90wwAwVZA8P1MHIw8biLLtDV+osnhJQ8yQCXAZG2ED4snoCbV5s2SczbTgksT
BWzEiCEQqf5s0lF1cgnCjkaYpIidpZ55O7iVSYTFnvlAd8Aw6cAH0Xe0V9VF+WhG
0tW3GBTIaOX4ZEfwMD0nSxdAorL1UWYt3HgDjaGNlZBWzScdFlTHzLb7LXKQqLL2
CprrQo/n2Ryp+riKB4998YserFpoudeHRcYzTR4aq0bmgfYEVtXZuxhlcz75BdQh
nw2Ehas82qqOtszuDUbvvOkZguwUfwEtoAxH3yUxsGUUwISOPmn2ekdE8u4WRxos
lgemrveGSKjPmEEhWKSETR97lTe6XLAjiaPtiClxAQSmBOhtuY0LqZpmhkh9B2Ru
R6QBnF+iZDAc7e0OQ7Bqug273Swhub5YbDS2qs2YL63EO+SKo528SNcznJRHBI8a
ZBdKWDxqMJysj5LkrW4oeIH312vcMK1wbBjiF5IZpmalShvHHux7oxPVFUpTEOfu
ywn7IU9C
=3lWE
-----END PGP SIGNATURE-----
Timestamp of file with hash f5a11e9d65e3f6cfd270f092131edbd8b4b33243c1a93c5ebd8c3244f41517df -
</details>
Weren't all the commits here missing the backport metadata?
Probably, what backport metadata should be in a commit?
Maybe we should mention the backport script in the contrib/devtools readme?
The code itself was the same when I did the backport, but those were the commit differences (via range-diff):
1: ee950ec465 ! 1: 1057254270 [rpc] walletcreatefundedpsbt: use wallet default RBF
@@ -2,6 +2,9 @@
[rpc] walletcreatefundedpsbt: use wallet default RBF
+ Github-Pull: [#15911](/bitcoin-bitcoin/15911/)
+ Rebased-From: 4fcb698bc2bb74171cd3a14b94f9882d8e19e9fb
+
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -84,6 +87,15 @@
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@
+ {"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
+ },
+ },
+- {"replaceable", RPCArg::Type::BOOL, /* default */ "false", "Marks this transaction as BIP125 replaceable.\n"
++ {"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Marks this transaction as BIP125 replaceable.\n"
+ " Allows this transaction to be replaced by a transaction with higher fees"},
+ {"conf_target", RPCArg::Type::NUM, /* default */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"},
+ {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
+@@
CAmount fee;
int change_position;
@@ -119,12 +131,12 @@
block_height = self.nodes[0].getblockcount()
unspent = self.nodes[0].listunspent()[0]
- 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)
-+ 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)
++ 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)
decoded_psbt = self.nodes[0].decodepsbt(psbtx_info["psbt"])
for tx_in, psbt_in in zip(decoded_psbt["tx"]["vin"], decoded_psbt["inputs"]):
- assert_equal(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
- assert "bip32_derivs" not in psbt_in
-+ assert(tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE)
++ assert tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE
+ assert "bip32_derivs" not in psbt_in
assert_equal(decoded_psbt["tx"]["locktime"], block_height+2)
2: 0942a60c06 ! 2: 7ab99cf477 [doc] rpc: remove "fallback to" from RBF default help
@@ -2,6 +2,9 @@
[doc] rpc: remove "fallback to" from RBF default help
+ Github-Pull: [#15911](/bitcoin-bitcoin/15911/)
+ Rebased-From: 9ed062b5685eb6227d694572cb0f7bfbcc151b36
+
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -48,12 +51,3 @@
{"totalFee", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "Total fee (NOT feerate) to pay, in satoshis.\n"
" In rare cases, the actual fee paid might be slightly higher than the specified\n"
" totalFee if the tx change output has to be removed because it is too close to\n"
-@@
- {"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
- },
- },
-- {"replaceable", RPCArg::Type::BOOL, /* default */ "false", "Marks this transaction as BIP125 replaceable.\n"
-+ {"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Marks this transaction as BIP125 replaceable.\n"
- " Allows this transaction to be replaced by a transaction with higher fees"},
- {"conf_target", RPCArg::Type::NUM, /* default */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"},
- {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
3: 576580fe8a ! 3: 86bc93ec44 [test] walletcreatefundedpsbt: check RBF is disabled when -walletrbf=0
@@ -2,19 +2,13 @@
[test] walletcreatefundedpsbt: check RBF is disabled when -walletrbf=0
+ Github-Pull: [#15911](/bitcoin-bitcoin/15911/)
+ Rebased-From: d6b3640ac732f6f66a8cb6761084d1beecc8a876
+
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@
-
- from decimal import Decimal
- from test_framework.test_framework import BitcoinTestFramework
--from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes_bi, disconnect_nodes, find_output, sync_blocks
-+from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, connect_nodes_bi, disconnect_nodes, find_output, sync_blocks
-
- import json
- import os
-@@
self.num_nodes = 3
self.extra_args = [
["-walletrbf=1"],
@@ -24,10 +18,10 @@
]
@@
- 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)
+ 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)
decoded_psbt = self.nodes[0].decodepsbt(psbtx_info["psbt"])
for tx_in, psbt_in in zip(decoded_psbt["tx"]["vin"], decoded_psbt["inputs"]):
-- assert(tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE)
+- assert tx_in["sequence"] > MAX_BIP125_RBF_SEQUENCE
+ assert_greater_than(tx_in["sequence"], MAX_BIP125_RBF_SEQUENCE)
assert "bip32_derivs" not in psbt_in
assert_equal(decoded_psbt["tx"]["locktime"], block_height+2)
Yeah the Github-Pull: and Rebased-From: were missing
See https://github.com/bitcoin-core/bitcoin-maintainer-tools#backport for a script to backport