|
|
|
@ -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 #
|
|
|
|
|