test: use MiniWallet for feature_csv_activation.py #21900

pull theStack wants to merge 2 commits into bitcoin:master from theStack:20210507-test-convert_csvtest_miniwallet changing 2 files +103 −106
  1. theStack commented at 11:23 pm on May 9, 2021: member

    This PR enables one more of the non-wallet functional tests (feature_csv_activation.py) to be run even with the Bitcoin Core wallet disabled by using the new MiniWallet instead, as proposed in #20078.

    Short reviewers guideline:

    • Since we exclusively work with anyone-can-spend outputs here (raw scriptPubKey = OP_TRUE), signing is not needed anymore. The function sign_transaction and its calls are removed, after changing a tx (e.g. its scriptSig or nVersion) a simple .rehash() call is sufficient. Also, generating an address self.nodeaddress (and with that, passing it to the the various test tx creation/sending helper methods) is not needed anymore and removed.
    • The test repeatedly uses the same input for creating different txs (e.g. with different txversions 1 and 2). To let MiniWallet create a tx with a specific input, we have to call .get_utxo() before which also marks the UTXO as spent. The method is changed to also support keeping the UTXO in its internal list (mark_as_spent=False). With the behaviour on master, the second call to .get_utxo() with the same input would fail.
    • To keep the diff in the first commit short, the miniwallet is set as a global variable, to avoid passing it on every tx creation/spending helper. The global is eliminated in the second (refactoring) commit, where all the helpers are moved to the test class as methods. By that, we can use self.nodes[0] directly in the helpers and don’t have to pass it again and again. I think there could still be a lot of improvements/refactoring done in the test, but that should hopefully serve as a good basis.
  2. fanquake added the label Tests on May 9, 2021
  3. test: use MiniWallet for feature_csv_activation.py
    This test can now be run even with the Bitcoin Core wallet disabled.
    2eca46b0aa
  4. refactor: feature_csv_activation.py: move tx helper functions to methods
    This allows to get rid of the global miniwallet variable and to specify
    the used node self.nodes[0] at only one place, instead of passing it to
    every tx creation/send method again and again.
    
    Can be reviewed with --ignore-all-space --color-moved=dimmed-zebra
    bd7f27d16d
  5. theStack force-pushed on May 9, 2021
  6. laanwj commented at 10:48 am on May 10, 2021: member
    Code review ACK bd7f27d16dacf6f7de3b4f6bd052def41d9601be
  7. MarcoFalke commented at 3:48 pm on May 10, 2021: member

    review ACK bd7f27d16dacf6f7de3b4f6bd052def41d9601be 🐕

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3review ACK bd7f27d16dacf6f7de3b4f6bd052def41d9601be 🐕
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUhdJwv9EbEK7JyML4wxs0e2BV4oiOiXls92YWe0BO65IzVDNJiLQaJeUJ3lqETg
     805pkpy2zweDJSGYpytfLj2wt9rhL4C8REqqhsQfAsY/zWGWCQg4Uml2g4P9mkRDQ
     9bWg+jr3AsiO367L1k7Ictm9tcLdtDC7C4YoJkzAnumvajbvpt7GRIq18KzHHR6Qb
    10OSCpxQf14O3muxyMsiRixxPHCsxtKmbSnIiezc9SIzXCs50PTYnFNPLwvIhUMcSc
    110mEbna/YwgsJRmr2QXqVaiaJDij4jE2kDB+J5DXbOXvp2+HrzDL93FL7012jDKRG
    12HiwaHyg0wkjPOs8TdZAsis7lUwKPYHYe7hxX397Uq/bClLvDTX0S1ElcLrHr87o6
    136ONs05VfKsl1QOWPeJTJrAl6c6RFE6x7LuGNnWwF6PPPy11dc0/UuqZkjhtFqCDW
    14hjzFOV46cHuvfkwOZRy8eJgzYchsYGZx8E1f4ho5Q6uzc6UxF96OMdhFvBkJEY7h
    158d28W72M
    16=AHhn
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash d0d7452f0e357ac3817de8619136214b39f29c122badffab8229d6118e90c698 -

  8. MarcoFalke merged this on May 10, 2021
  9. MarcoFalke closed this on May 10, 2021

  10. in test/functional/feature_csv_activation.py:93 in bd7f27d16d
    149         self.num_nodes = 1
    150         self.setup_clean_chain = True
    151         self.extra_args = [[
    152             '-whitelist=noban@127.0.0.1',
    153-            '-addresstype=legacy',
    154+            '-acceptnonstdtxn=1',
    


    MarcoFalke commented at 5:01 pm on May 10, 2021:
    Would be nice to not set this. Maybe someone can teach the miniwallet how to create pay-to-raw-pubkey or so?
  11. sidhujag referenced this in commit cbcd58b7ad on May 10, 2021
  12. MarcoFalke referenced this in commit 778b920179 on May 24, 2021
  13. sidhujag referenced this in commit 764ff1f002 on May 25, 2021
  14. theStack deleted the branch on Jul 31, 2021
  15. gwillen referenced this in commit 7447a3b352 on Jun 1, 2022
  16. DrahtBot locked this on Aug 18, 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-09-28 22:12 UTC

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