test: MiniWallet: introduce enum type for output mode #22048

pull theStack wants to merge 1 commits into bitcoin:master from theStack:202105-test-improve_miniwallet changing 3 files +39 −8
  1. theStack commented at 5:45 PM on May 24, 2021: member

    This is a follow-up PR to #21945 which lifted the number of MiniWallet's tx output modes from 2 to 3 (by adding P2PK Support). Since the current way of specifying the mode on the ctor via two booleans is ugly and error-prone (see table in comment #21945 (comment)), a new Enum type MiniWalletMode is introduced that can hold the following values:

    • ADDRESS_OP_TRUE
    • RAW_OP_TRUE
    • RAW_P2PK

    Also adds documentation that should guide the user on which mode is useful for what etc. with a summary table. (Can also be split up in a separate commit or shortened if that is desired, maybe it's considered to be too verbose).

  2. test: MiniWallet: introduce enum type for output mode
    For the MiniWallet constructor, the two boolean parameters
    "raw_script" and "use_p2pk" are replaced by a single parameter of the
    newly introduced type MiniWalletMode (derived by enum.Enum), which can
    hold the following values:
    	- ADDRESS_OP_TRUE
    	- RAW_OP_TRUE
    	- RAW_P2PK
    6cebac598e
  3. DrahtBot added the label Tests on May 24, 2021
  4. reemuru commented at 8:31 PM on May 24, 2021: none

    Tested ACK. Run on Fedora 34.

    <details><summary>log</summary>

    [user@fedora bitcoin]$ git grep MiniWalletMode
    test/functional/feature_cltv.py:    MiniWalletMode,
    test/functional/feature_cltv.py:        wallet = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_OP_TRUE)
    test/functional/feature_csv_activation.py:    MiniWalletMode,
    test/functional/feature_csv_activation.py:        self.miniwallet = MiniWallet(self.nodes[0], mode=MiniWalletMode.RAW_P2PK)
    test/functional/test_framework/wallet.py:class MiniWalletMode(Enum):
    test/functional/test_framework/wallet.py:    def __init__(self, test_node, *, mode=MiniWalletMode.ADDRESS_OP_TRUE):
    test/functional/test_framework/wallet.py:        assert isinstance(mode, MiniWalletMode)
    test/functional/test_framework/wallet.py:        if mode == MiniWalletMode.RAW_OP_TRUE:
    test/functional/test_framework/wallet.py:        elif mode == MiniWalletMode.RAW_P2PK:
    test/functional/test_framework/wallet.py:        elif mode == MiniWalletMode.ADDRESS_OP_TRUE:
    
    [user@fedora bitcoin]$ ./test/functional/feature_csv_activation.py 
    2021-05-24T20:29:11.065000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_wrpsqui0
    2021-05-24T20:29:11.457000Z TestFramework (INFO): Generate blocks in the past for coinbase outputs.
    2021-05-24T20:29:12.781000Z TestFramework (INFO): Height = 430, CSV not yet active (will activate for block 432, not 431)
    2021-05-24T20:29:13.915000Z TestFramework (INFO): TESTING
    2021-05-24T20:29:13.915000Z TestFramework (INFO): Pre-Soft Fork Tests. All txs should pass.
    2021-05-24T20:29:13.915000Z TestFramework (INFO): Test version 1 txs
    2021-05-24T20:29:14.038000Z TestFramework (INFO): Test version 2 txs
    2021-05-24T20:29:14.279000Z TestFramework (INFO): Post-Soft Fork Tests.
    2021-05-24T20:29:14.279000Z TestFramework (INFO): BIP 113 tests
    2021-05-24T20:29:14.861000Z TestFramework (INFO): BIP 68 tests
    2021-05-24T20:29:14.861000Z TestFramework (INFO): Test version 1 txs - all should still pass
    2021-05-24T20:29:14.977000Z TestFramework (INFO): Test version 2 txs
    2021-05-24T20:29:16.794000Z TestFramework (INFO): BIP 112 tests
    2021-05-24T20:29:16.795000Z TestFramework (INFO): Test version 1 txs
    2021-05-24T20:29:22.180000Z TestFramework (INFO): Test version 2 txs
    2021-05-24T20:29:27.030000Z TestFramework (INFO): Stopping nodes
    2021-05-24T20:29:27.184000Z TestFramework (INFO): Cleaning up /tmp/bitcoin_func_test_wrpsqui0 on exit
    2021-05-24T20:29:27.185000Z TestFramework (INFO): Tests successful
    

    </details>

  5. reemuru approved
  6. MarcoFalke commented at 5:26 AM on May 25, 2021: member

    cr ACK 6cebac598e5e85eadd60eb1274d7f33d63ce1108

  7. MarcoFalke merged this on May 25, 2021
  8. MarcoFalke closed this on May 25, 2021

  9. sidhujag referenced this in commit 2a269095ea on May 25, 2021
  10. theStack deleted the branch on Jul 31, 2021
  11. gwillen referenced this in commit ff5c2de782 on Jun 1, 2022
  12. DrahtBot locked this on Aug 16, 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-14 21:14 UTC

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