Skip to content

Commit 8244813

Browse files
LongShao007PiRK
authored andcommitted
[backport#16078] replace tx hash with txid in test rawtransaction
Summary: Comment by @sipa: > txid is correct here, as it's about arguments to the gettransansaction RPC. This is a partial backport of Core [[bitcoin/bitcoin#16078 | PR16078]] Commit bitcoin/bitcoin@a65dafa The next commit is not needed as its changes are overwritten in D8027 / PR16251 See D1556 for why we have additional lines changed. Test Plan: `ninja && ninja && test/functional/test_runner.py rpc_rawtransaction.py` Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D8050
1 parent bf580dc commit 8244813

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

test/functional/rpc_rawtransaction.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -430,45 +430,46 @@ def run_test(self):
430430

431431
# getrawtransaction tests
432432
# 1. valid parameters - only supply txid
433-
txHash = rawTx["hash"]
433+
txId = rawTx["txid"]
434434
assert_equal(
435-
self.nodes[0].getrawtransaction(txHash), rawTxSigned['hex'])
435+
self.nodes[0].getrawtransaction(txId), rawTxSigned['hex'])
436436

437437
# 2. valid parameters - supply txid and 0 for non-verbose
438438
assert_equal(
439-
self.nodes[0].getrawtransaction(txHash, 0), rawTxSigned['hex'])
439+
self.nodes[0].getrawtransaction(txId, 0), rawTxSigned['hex'])
440440

441441
# 3. valid parameters - supply txid and False for non-verbose
442-
assert_equal(self.nodes[0].getrawtransaction(
443-
txHash, False), rawTxSigned['hex'])
442+
assert_equal(self.nodes[0].getrawtransaction(txId, False),
443+
rawTxSigned['hex'])
444444

445445
# 4. valid parameters - supply txid and 1 for verbose.
446446
# We only check the "hex" field of the output so we don't need to
447447
# update this test every time the output format changes.
448-
assert_equal(self.nodes[0].getrawtransaction(
449-
txHash, 1)["hex"], rawTxSigned['hex'])
448+
assert_equal(self.nodes[0].getrawtransaction(txId, 1)["hex"],
449+
rawTxSigned['hex'])
450450

451451
# 5. valid parameters - supply txid and True for non-verbose
452-
assert_equal(self.nodes[0].getrawtransaction(
453-
txHash, True)["hex"], rawTxSigned['hex'])
452+
assert_equal(self.nodes[0].getrawtransaction(txId, True)["hex"],
453+
rawTxSigned['hex'])
454454

455455
# 6. invalid parameters - supply txid and string "Flase"
456-
assert_raises_rpc_error(
457-
-1, "not a boolean", self.nodes[0].getrawtransaction, txHash, "False")
456+
assert_raises_rpc_error(-1, "not a boolean",
457+
self.nodes[0].getrawtransaction,
458+
txId, "Flase")
458459

459460
# 7. invalid parameters - supply txid and empty array
460-
assert_raises_rpc_error(
461-
-1, "not a boolean", self.nodes[0].getrawtransaction, txHash, [])
461+
assert_raises_rpc_error(-1, "not a boolean",
462+
self.nodes[0].getrawtransaction, txId, [])
462463

463464
# 8. invalid parameters - supply txid and empty dict
464465
assert_raises_rpc_error(
465-
-1, "not a boolean", self.nodes[0].getrawtransaction, txHash, {})
466+
-1, "not a boolean", self.nodes[0].getrawtransaction, txId, {})
466467

467468
# Sanity checks on verbose getrawtransaction output
468-
rawTxOutput = self.nodes[0].getrawtransaction(txHash, True)
469+
rawTxOutput = self.nodes[0].getrawtransaction(txId, True)
469470
assert_equal(rawTxOutput["hex"], rawTxSigned["hex"])
470-
assert_equal(rawTxOutput["txid"], txHash)
471-
assert_equal(rawTxOutput["hash"], txHash)
471+
assert_equal(rawTxOutput["txid"], txId)
472+
assert_equal(rawTxOutput["hash"], txId)
472473
assert_greater_than(rawTxOutput["size"], 300)
473474
assert_equal(rawTxOutput["version"], 0x02)
474475
assert_equal(rawTxOutput["locktime"], 0)

0 commit comments

Comments
 (0)