Skip to content

Commit 6954e4d

Browse files
committed
Merge bitcoin#20283: test: Only try witness deser when checking for witness deser failure
fae45c3 test: Only try witness deserialize when checking for witness deserialize failure (MarcoFalke) Pull request description: Witness deserialize will fail always. (This is what the test is checking for) Consequently, non-witness deserialize is also tried, and it might succeed accidentally. Avoid that by not trying non-witness deserialize. Fixes bitcoin#20249 ACKs for top commit: jnewbery: utACK fae45c3 Tree-SHA512: 45e65b31603e3ca839776a7ed30e363b32eba20dfb67b7b55bff06715876850d4f6ba22f8ea4911a62e1f8ffff395bf187b23c46ddc766516b97057df000deb3
2 parents 83650e4 + fae45c3 commit 6954e4d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/p2p_segwit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,14 +2097,14 @@ def serialize(self):
20972097

20982098
raw = self.nodes[0].createrawtransaction([{"txid": unspent['txid'], "vout": unspent['vout']}], {self.nodes[0].getnewaddress(): 1})
20992099
tx = FromHex(CTransaction(), raw)
2100-
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, serialize_with_bogus_witness(tx).hex())
2100+
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
21012101
with self.nodes[0].assert_debug_log(['Superfluous witness record']):
21022102
self.test_node.send_and_ping(msg_bogus_tx(tx))
21032103
raw = self.nodes[0].signrawtransactionwithwallet(raw)
21042104
assert raw['complete']
21052105
raw = raw['hex']
21062106
tx = FromHex(CTransaction(), raw)
2107-
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, serialize_with_bogus_witness(tx).hex())
2107+
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
21082108
with self.nodes[0].assert_debug_log(['Unknown transaction optional data']):
21092109
self.test_node.send_and_ping(msg_bogus_tx(tx))
21102110

0 commit comments

Comments
 (0)