Skip to content

Commit 4a0dab8

Browse files
thepastaclawclaude
andcommitted
test: fix falsy-value bug for collateral_vout and improve getrawtransaction tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 71e32ef commit 4a0dab8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

test/functional/rpc_rawtransaction.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def getrawtransaction_tests(self):
114114
assert_equal(self.nodes[n].getrawtransaction(txId, True)["hex"], tx['hex'])
115115
assert_equal(self.nodes[n].getrawtransactionmulti({"0":[txId]}, True)[txId]['hex'], tx['hex'])
116116

117-
# 4. valid parameters - supply txid and True for verbose (named args)
118-
assert_equal(self.nodes[n].getrawtransaction(txId, True)["hex"], tx['hex'])
117+
# 4. valid parameters - supply txid and True for verbose using named args
118+
assert_equal(self.nodes[n].getrawtransaction(txid=txId, verbose=True)["hex"], tx['hex'])
119119
assert_equal(self.nodes[n].getrawtransactionmulti(verbose=True, transactions={"0":[txId]})[txId]['hex'], tx['hex'])
120120
else:
121121
# Without -txindex, expect to raise.
@@ -135,6 +135,11 @@ def getrawtransaction_tests(self):
135135
# 8. invalid parameters - supply txid and empty dict
136136
assert_raises_rpc_error(-3, "not of expected type bool", self.nodes[n].getrawtransaction, txId, {})
137137

138+
# 9. invalid parameters - supply txid and integer values for verbose (type checking rejects non-bool)
139+
for value in [0, 1]:
140+
assert_raises_rpc_error(-3, "not of expected type bool", self.nodes[n].getrawtransaction, txid=txId, verbose=value)
141+
assert_raises_rpc_error(-3, "not of expected type bool", self.nodes[n].getrawtransactionmulti, transactions={"0":[txId]}, verbose=value)
142+
138143
# Make a tx by sending, then generate 2 blocks; block1 has the tx in it
139144
tx = self.wallet.send_self_transfer(from_node=self.nodes[2])['txid']
140145
block1, block2 = self.generate(self.nodes[2], 2)

test/functional/test_framework/test_framework.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ def register(self, node: TestNode, submit: bool, collateral_txid: Optional[str]
12681268
# Common arguments shared between regular masternodes and EvoNodes
12691269
args = [
12701270
collateral_txid or self.collateral_txid,
1271-
collateral_vout or self.collateral_vout,
1271+
collateral_vout if collateral_vout is not None else self.collateral_vout,
12721272
[f'127.0.0.1:{self.nodePort}'] if addrs_core_p2p is None else addrs_core_p2p,
12731273
ownerAddr or self.ownerAddr,
12741274
pubKeyOperator or self.pubKeyOperator,

0 commit comments

Comments
 (0)