Remove manual byte editing in wallet_tx_clone func test #15397

pull instagibbs wants to merge 1 commits into bitcoin:master from instagibbs:wallet_clone_magic changing 1 files +7 −10
  1. instagibbs commented at 2:52 pm on February 13, 2019: member
    Adapted from @stevenroose
  2. Remove manual byte editing in wallet_tx_clone func test 6aaa0abc12
  3. stevenroose commented at 3:12 pm on February 13, 2019: contributor
  4. MarcoFalke added this to the milestone 0.19.0 on Feb 13, 2019
  5. in test/functional/wallet_txn_clone.py:84 in 6aaa0abc12
    89+            (clone_tx.vout[0], clone_tx.vout[1]) = (clone_tx.vout[1], clone_tx.vout[0])
    90 
    91         # Use a different signature hash type to sign.  This creates an equivalent but malleated clone.
    92         # Don't send the clone anywhere yet
    93-        tx1_clone = self.nodes[0].signrawtransactionwithwallet(clone_raw, None, "ALL|ANYONECANPAY")
    94+        tx1_clone = self.nodes[0].signrawtransactionwithwallet(clone_tx.serialize().hex(), None, "ALL|ANYONECANPAY")
    


    MarcoFalke commented at 3:51 pm on February 13, 2019:
    Assigned 0.19.0, because this is python3.5 only

    instagibbs commented at 3:59 pm on February 13, 2019:
    SGTM, I like the syntax way more. So should I ping once 0.18 is branched?

    MarcoFalke commented at 4:09 pm on February 13, 2019:
    Remind me #14954

    MarcoFalke commented at 2:20 pm on February 18, 2019:

    Already broken in master, so just going to merge this as well :woman_shrugging:

    0$ git grep -l '\.hex()' test/
    1test/functional/mining_basic.py
    2test/functional/test_framework/wallet_util.py
    3test/functional/wallet_txn_clone.py
    

    instagibbs commented at 2:23 pm on February 18, 2019:
    Yeah at least partially my bad :1st_place_medal:
  6. in test/functional/wallet_txn_clone.py:80 in 6aaa0abc12
    84-            output1 = clone_raw[pos0 + output_len:pos0 + 2 * output_len]
    85-            clone_raw = clone_raw[:pos0] + output1 + output0 + clone_raw[pos0 + 2 * output_len:]
    86+        clone_tx = CTransaction()
    87+        clone_tx.deserialize(io.BytesIO(bytes.fromhex(clone_raw)))
    88+        if (rawtx1["vout"][0]["value"] == 40 and clone_tx.vout[0].nValue != 40*COIN or rawtx1["vout"][0]["value"] != 40 and clone_tx.vout[0].nValue == 40*COIN):
    89+            (clone_tx.vout[0], clone_tx.vout[1]) = (clone_tx.vout[1], clone_tx.vout[0])
    


    MarcoFalke commented at 3:52 pm on February 13, 2019:
    nice swap

    practicalswift commented at 5:49 pm on February 13, 2019:
    Nit: Parantheses redundant :-)
  7. MarcoFalke approved
  8. MarcoFalke added the label Tests on Feb 13, 2019
  9. in test/functional/wallet_txn_clone.py:79 in 6aaa0abc12
    83-            output0 = clone_raw[pos0:pos0 + output_len]
    84-            output1 = clone_raw[pos0 + output_len:pos0 + 2 * output_len]
    85-            clone_raw = clone_raw[:pos0] + output1 + output0 + clone_raw[pos0 + 2 * output_len:]
    86+        clone_tx = CTransaction()
    87+        clone_tx.deserialize(io.BytesIO(bytes.fromhex(clone_raw)))
    88+        if (rawtx1["vout"][0]["value"] == 40 and clone_tx.vout[0].nValue != 40*COIN or rawtx1["vout"][0]["value"] != 40 and clone_tx.vout[0].nValue == 40*COIN):
    


    practicalswift commented at 5:49 pm on February 13, 2019:
    Nit: Parantheses redundant :-)
  10. jonasschnelli commented at 1:55 am on February 14, 2019: contributor
    Oh yes. Thanks for doing this. utACK 6aaa0abc1241ad26f5895760701e77c9c8e93924 once 0.18 is branched off.
  11. MarcoFalke merged this on Feb 18, 2019
  12. MarcoFalke closed this on Feb 18, 2019

  13. MarcoFalke referenced this in commit 6ba3f1fdfd on Feb 18, 2019
  14. MarcoFalke referenced this in commit f9775a8655 on Feb 20, 2019
  15. jasonbcox referenced this in commit 48be096909 on Nov 11, 2020
  16. vijaydasmp referenced this in commit e4cc574adb on Sep 5, 2021
  17. Munkybooty referenced this in commit bab6f73d41 on Sep 5, 2021
  18. vijaydasmp referenced this in commit 11dd890928 on Sep 6, 2021
  19. Munkybooty referenced this in commit 4e0492847d on Sep 7, 2021
  20. Munkybooty referenced this in commit ed5543e6bf on Sep 7, 2021
  21. Munkybooty referenced this in commit bc7ca5d837 on Sep 7, 2021
  22. Munkybooty referenced this in commit b654e48dbc on Sep 7, 2021
  23. DrahtBot locked this on Sep 6, 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: 2024-10-05 04:12 UTC

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