Skip to content

Commit 85d8869

Browse files
committed
test: run 2nd getrawtransaction section with/without -txindex
(and make the 'string "Flase"' test clearer as requested by reviewers)
1 parent 0097740 commit 85d8869

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

test/functional/rpc_rawtransaction.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -426,30 +426,33 @@ def run_test(self):
426426
self.sync_all()
427427

428428
# getrawtransaction tests
429-
# 1. valid parameters - only supply txid
430-
assert_equal(self.nodes[0].getrawtransaction(txId), rawTxSigned['hex'])
429+
for n in [0, 3]:
430+
self.log.info(f"Test getrawtransaction {'with' if n == 0 else 'without'} -txindex")
431+
# 1. valid parameters - only supply txid
432+
assert_equal(self.nodes[n].getrawtransaction(txId), rawTxSigned['hex'])
431433

432-
# 2. valid parameters - supply txid and 0 for non-verbose
433-
assert_equal(self.nodes[0].getrawtransaction(txId, 0), rawTxSigned['hex'])
434+
# 2. valid parameters - supply txid and 0 for non-verbose
435+
assert_equal(self.nodes[n].getrawtransaction(txId, 0), rawTxSigned['hex'])
434436

435-
# 3. valid parameters - supply txid and False for non-verbose
436-
assert_equal(self.nodes[0].getrawtransaction(txId, False), rawTxSigned['hex'])
437+
# 3. valid parameters - supply txid and False for non-verbose
438+
assert_equal(self.nodes[n].getrawtransaction(txId, False), rawTxSigned['hex'])
437439

438-
# 4. valid parameters - supply txid and 1 for verbose.
439-
# We only check the "hex" field of the output so we don't need to update this test every time the output format changes.
440-
assert_equal(self.nodes[0].getrawtransaction(txId, 1)["hex"], rawTxSigned['hex'])
440+
# 4. valid parameters - supply txid and 1 for verbose.
441+
# We only check the "hex" field of the output so we don't need to update this test every time the output format changes.
442+
assert_equal(self.nodes[n].getrawtransaction(txId, 1)["hex"], rawTxSigned['hex'])
441443

442-
# 5. valid parameters - supply txid and True for non-verbose
443-
assert_equal(self.nodes[0].getrawtransaction(txId, True)["hex"], rawTxSigned['hex'])
444+
# 5. valid parameters - supply txid and True for non-verbose
445+
assert_equal(self.nodes[n].getrawtransaction(txId, True)["hex"], rawTxSigned['hex'])
444446

445-
# 6. invalid parameters - supply txid and string "Flase"
446-
assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, "Flase")
447+
# 6. invalid parameters - supply txid and invalid boolean values (strings) for verbose
448+
for value in ["True", "False"]:
449+
assert_raises_rpc_error(-1, "not a boolean", self.nodes[n].getrawtransaction, txid=txId, verbose=value)
447450

448-
# 7. invalid parameters - supply txid and empty array
449-
assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, [])
451+
# 7. invalid parameters - supply txid and empty array
452+
assert_raises_rpc_error(-1, "not a boolean", self.nodes[n].getrawtransaction, txId, [])
450453

451-
# 8. invalid parameters - supply txid and empty dict
452-
assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, {})
454+
# 8. invalid parameters - supply txid and empty dict
455+
assert_raises_rpc_error(-1, "not a boolean", self.nodes[n].getrawtransaction, txId, {})
453456

454457
####################################
455458
# TRANSACTION VERSION NUMBER TESTS #

0 commit comments

Comments
 (0)