Skip to content

Commit 1f63b46

Browse files
committed
Merge bitcoin/bitcoin#25267: test: check replaceable mismatch error in createrawtransaction RPC
1bace0c test: check `replaceable` mismatch error in `createrawtransaction` RPC (Sebastian Falbesoner) Pull request description: This PR adds missing test coverage for the createrawtransaction RPC, in the case that the `replaceable` parameter is set, but the passed transaction doesn't signal RBF (i.e. no input's nSequence is < 0xffffffe): https://github.com/bitcoin/bitcoin/blob/1c7ef0abd11f35a27cc860ceb7e075b78f53cecf/src/rpc/rawtransaction_util.cpp#L135-L137 ACKs for top commit: laanwj: Code review ACK 1bace0c brunoerg: crACK 1bace0c furszy: Code review ACK 1bace0c Tree-SHA512: e6390401c8026c782643e3de7be56ea1745736b7e4c8886186d75c353c301b57afdabb631b9d8e2770386e4d7a59ac5fba1f380b9a5a21296512ca4515b35baa
2 parents b11ab25 + 1bace0c commit 1f63b46

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/functional/rpc_rawtransaction.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from test_framework.blocktools import COINBASE_MATURITY
1919
from test_framework.messages import (
20+
BIP125_SEQUENCE_NUMBER,
2021
CTransaction,
2122
tx_from_hex,
2223
)
@@ -220,6 +221,10 @@ def createrawtransaction_tests(self):
220221
assert_raises_rpc_error(-8, "Invalid parameter, key-value pair must contain exactly one key", self.nodes[0].createrawtransaction, [], [{'a': 1, 'b': 2}])
221222
assert_raises_rpc_error(-8, "Invalid parameter, key-value pair not an object as expected", self.nodes[0].createrawtransaction, [], [['key-value pair1'], ['2']])
222223

224+
# Test `createrawtransaction` mismatch between sequence number(s) and `replaceable` option
225+
assert_raises_rpc_error(-8, "Invalid parameter combination: Sequence number(s) contradict replaceable option",
226+
self.nodes[0].createrawtransaction, [{'txid': TXID, 'vout': 0, 'sequence': BIP125_SEQUENCE_NUMBER+1}], {}, 0, True)
227+
223228
# Test `createrawtransaction` invalid `locktime`
224229
assert_raises_rpc_error(-3, "Expected type number", self.nodes[0].createrawtransaction, [], {}, 'foo')
225230
assert_raises_rpc_error(-8, "Invalid parameter, locktime out of range", self.nodes[0].createrawtransaction, [], {}, -1)

0 commit comments

Comments
 (0)