Skip to content

Conversation

theStack
Copy link
Contributor

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).

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
@DrahtBot DrahtBot added the Tests label May 24, 2021
@reemuru
Copy link

reemuru commented May 24, 2021

Tested ACK. Run on Fedora 34.

log
[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

@maflcko
Copy link
Member

maflcko commented May 25, 2021

cr ACK 6cebac5

@maflcko maflcko merged commit 0a90907 into bitcoin:master May 25, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 25, 2021
… mode

6cebac5 test: MiniWallet: introduce enum type for output mode (Sebastian Falbesoner)

Pull request description:

  This is a follow-up PR to bitcoin#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 bitcoin#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).

ACKs for top commit:
  MarcoFalke:
    cr ACK 6cebac5

Tree-SHA512: cbbc10806d9d9e62829548094415e9f1a281cd247b9a9fc7f7f33b923c723aa03e7bc3024623a77fb1f7da4d73455fa8244840f746980d32acdad97ee12100da
@theStack theStack deleted the 202105-test-improve_miniwallet branch July 31, 2021 20:07
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants