aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-07-11 15:42:42 +0200
committerJon Atack <jon@atack.com>2021-08-31 20:51:26 +0200
commit85d8869cf89fedf243748e3e15b3ed39de1b0385 (patch)
tree9d85b4dbb534d3dc05601014b0ad75aaafe8015d /test
parent00977407732969593800d15de39abbb7e0250abc (diff)
downloadbitcoin-85d8869cf89fedf243748e3e15b3ed39de1b0385.tar.xz
test: run 2nd getrawtransaction section with/without -txindex
(and make the 'string "Flase"' test clearer as requested by reviewers)
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_rawtransaction.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py
index 619ad1bcd7..89088e9fc6 100755
--- a/test/functional/rpc_rawtransaction.py
+++ b/test/functional/rpc_rawtransaction.py
@@ -426,30 +426,33 @@ class RawTransactionsTest(BitcoinTestFramework):
self.sync_all()
# getrawtransaction tests
- # 1. valid parameters - only supply txid
- assert_equal(self.nodes[0].getrawtransaction(txId), rawTxSigned['hex'])
+ for n in [0, 3]:
+ self.log.info(f"Test getrawtransaction {'with' if n == 0 else 'without'} -txindex")
+ # 1. valid parameters - only supply txid
+ assert_equal(self.nodes[n].getrawtransaction(txId), rawTxSigned['hex'])
- # 2. valid parameters - supply txid and 0 for non-verbose
- assert_equal(self.nodes[0].getrawtransaction(txId, 0), rawTxSigned['hex'])
+ # 2. valid parameters - supply txid and 0 for non-verbose
+ assert_equal(self.nodes[n].getrawtransaction(txId, 0), rawTxSigned['hex'])
- # 3. valid parameters - supply txid and False for non-verbose
- assert_equal(self.nodes[0].getrawtransaction(txId, False), rawTxSigned['hex'])
+ # 3. valid parameters - supply txid and False for non-verbose
+ assert_equal(self.nodes[n].getrawtransaction(txId, False), rawTxSigned['hex'])
- # 4. valid parameters - supply txid and 1 for verbose.
- # We only check the "hex" field of the output so we don't need to update this test every time the output format changes.
- assert_equal(self.nodes[0].getrawtransaction(txId, 1)["hex"], rawTxSigned['hex'])
+ # 4. valid parameters - supply txid and 1 for verbose.
+ # We only check the "hex" field of the output so we don't need to update this test every time the output format changes.
+ assert_equal(self.nodes[n].getrawtransaction(txId, 1)["hex"], rawTxSigned['hex'])
- # 5. valid parameters - supply txid and True for non-verbose
- assert_equal(self.nodes[0].getrawtransaction(txId, True)["hex"], rawTxSigned['hex'])
+ # 5. valid parameters - supply txid and True for non-verbose
+ assert_equal(self.nodes[n].getrawtransaction(txId, True)["hex"], rawTxSigned['hex'])
- # 6. invalid parameters - supply txid and string "Flase"
- assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, "Flase")
+ # 6. invalid parameters - supply txid and invalid boolean values (strings) for verbose
+ for value in ["True", "False"]:
+ assert_raises_rpc_error(-1, "not a boolean", self.nodes[n].getrawtransaction, txid=txId, verbose=value)
- # 7. invalid parameters - supply txid and empty array
- assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, [])
+ # 7. invalid parameters - supply txid and empty array
+ assert_raises_rpc_error(-1, "not a boolean", self.nodes[n].getrawtransaction, txId, [])
- # 8. invalid parameters - supply txid and empty dict
- assert_raises_rpc_error(-1, "not a boolean", self.nodes[0].getrawtransaction, txId, {})
+ # 8. invalid parameters - supply txid and empty dict
+ assert_raises_rpc_error(-1, "not a boolean", self.nodes[n].getrawtransaction, txId, {})
####################################
# TRANSACTION VERSION NUMBER TESTS #