test: Only try witness deser when checking for witness deser failure #20283

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2011-testWitnessFail changing 1 files +2 −2
  1. MarcoFalke commented at 9:09 AM on November 2, 2020: member

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

  2. MarcoFalke added this to the milestone 0.21.0 on Nov 2, 2020
  3. fanquake added the label Tests on Nov 2, 2020
  4. in test/functional/p2p_segwit.py:2100 in fab3038983 outdated
    2096 | @@ -2097,14 +2097,14 @@ def serialize(self):
    2097 |  
    2098 |          raw = self.nodes[0].createrawtransaction([{"txid": unspent['txid'], "vout": unspent['vout']}], {self.nodes[0].getnewaddress(): 1})
    2099 |          tx = FromHex(CTransaction(), raw)
    2100 | -        assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, serialize_with_bogus_witness(tx).hex())
    2101 | +        assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, serialize_with_bogus_witness(tx).hex(), True)
    


    jnewbery commented at 10:34 AM on November 2, 2020:

    Named args so it's clear what the bool is please:

            assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
    

    Same below.

  5. jnewbery commented at 10:40 AM on November 2, 2020: member

    ACK fab30389839264e8999d60e91c9a894cf00f97c1

    One suggested change inline.

  6. test: Only try witness deserialize when checking for witness deserialize failure fae45c34d1
  7. MarcoFalke force-pushed on Nov 2, 2020
  8. jnewbery commented at 1:27 PM on November 2, 2020: member

    utACK fae45c34d1

  9. fanquake merged this on Nov 5, 2020
  10. fanquake closed this on Nov 5, 2020

  11. MarcoFalke deleted the branch on Nov 5, 2020
  12. sidhujag referenced this in commit 316556cae8 on Nov 5, 2020
  13. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 06:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me