Skip to content

test: use MiniWallet for rpc_scantxoutset.py - #23866

Merged
maflcko merged 3 commits into
bitcoin:masterfrom
theStack:202112-test-use_MiniWallet_for_rpc_scantxoutset
Dec 27, 2021
Merged

maflcko merged 3 commits into
bitcoin:masterfrom
theStack:202112-test-use_MiniWallet_for_rpc_scantxoutset

Conversation

@theStack

@theStack theStack commented Dec 26, 2021 •

Copy link
Copy Markdown
Contributor

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

Reviewer's guide:

  • [commit 1/3] For replacing the getnewaddress/getaddressinfo RPC calls a helper getnewdestination is introduced which allows to create addresses with the common address format types ('legacy', 'p2sh-segwit' and 'bech32'), but also additionally returns the corresponding pubkey and output script.
  • [commit 2/3] In order to send to addresses with MiniWallet, a helper address_to_scriptpubkey is introduced. It only supports legacy addresses (Base58Check) so far, which is sufficient for the scantxoutset test.
  • [commit 3/3] With those helpers, the use of MiniWallet in the test is quite straight-forward. To avoid repeatedly specifying parameters like from_node to MiniWallet's send_to method, another test-internal helper sendtodestination is introduced which supports specifying the destination both as outputscript or as address.

@fanquake fanquake added the Tests label Dec 26, 2021
@theStack
theStack force-pushed the 202112-test-use_MiniWallet_for_rpc_scantxoutset branch 2 times, most recently from 3e82f71 to 5df1496 Compare December 26, 2021 02:36
@DrahtBot

DrahtBot commented Dec 26, 2021 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

…ress types

This serves as a replacement for the getnewaddress RPC if no wallet is
available. In addition to the address, it also returns the corresponding
public key and output script (scriptPubKey).
Works only with legacy addresses (Base58Check) right now.
@theStack
theStack force-pushed the 202112-test-use_MiniWallet_for_rpc_scantxoutset branch from 5df1496 to a58aea0 Compare December 26, 2021 11:38
@theStack

Copy link
Copy Markdown
Contributor Author

Rebased on master.

@w0xlt w0xlt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK a58aea0

@maflcko maflcko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Looks very good.

Left some questions on the third commit for unrelated lines.

Comment thread test/functional/rpc_scantxoutset.py Resolved
Comment thread test/functional/rpc_scantxoutset.py Resolved
Comment thread test/functional/rpc_scantxoutset.py Resolved
Comment thread test/functional/rpc_scantxoutset.py Resolved
This test can now be run even with the Bitcoin Core wallet disabled.
@theStack
theStack force-pushed the 202112-test-use_MiniWallet_for_rpc_scantxoutset branch from a58aea0 to e844115 Compare December 26, 2021 14:54
@theStack

Copy link
Copy Markdown
Contributor Author

Force-pushed with most of the suggestions by MarcoFalke (#23866 (review)):

  • use pre-mined chain instead of manually generating new blocks
  • remove unnecessary node restarts

@w0xlt w0xlt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reACK e844115

@maflcko
maflcko merged commit d3582f2 into bitcoin:master Dec 27, 2021
@theStack
theStack deleted the 202112-test-use_MiniWallet_for_rpc_scantxoutset branch December 27, 2021 10:41
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 2, 2022
Summary:
Backport of [[bitcoin/bitcoin#23866 | core#23866]].

Depends on D12733.

Test Plan:
With and without wallet:
  ./test/functional/test_runner.py rpc_scantxoutset

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D12734
@bitcoin bitcoin locked and limited conversation to collaborators Dec 27, 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.

5 participants