Skip to content

Conversation

sriramdvt
Copy link
Contributor

Replace all wallet-related functionality in test/functional/mempool_accept.py to use MiniWallet instead of the wallet built with Bitcoin Core. This allows the test to run even if Bitcoin Core was compiled with --disable-wallet.

Work on mempool_accept.py started in #21014, but it has been inactive for some time. This PR also makes use of additional features like scan_blocks() and create_self_transfer() that were added to MiniWallet.

To test this PR, build Bitcoin Core with(out) the wallet and run:

$ test/functional/mempool_accept.py

@theStack
Copy link
Contributor

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 21, 2021

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #22788 (scripted-diff: Use generate* from TestFramework by MarcoFalke)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@sriramdvt sriramdvt force-pushed the mini_memaccept branch 2 times, most recently from 80008d0 to 48e55a8 Compare July 21, 2021 12:21
@theStack
Copy link
Contributor

@sriramdvt: Your PR was fine as it is -- #22378 is not merged into master yet, so there is no need to resolve a conflict by now; you can remove the second commit. The DrahtBot conflict message above just says that whenever either your PR or #22378 is merged, the other one very likely has to be rebased.

@maflcko
Copy link
Member

maflcko commented Jul 21, 2021

Concept ACK.

In the commit message, the Co-authored-by: needs to be a trailer (last line of the message).
( https://docs.github.com/en/github/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors )

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

Left some review comments below, most concerning variable naming and stylistic improvements. Probably the changes in MiniWallet (comment fix in scan_blocks, returning fee in create_self_transfer) deserve an own commit ahead of the changes in mempool_accept.py.

@practicalswift
Copy link
Contributor

Concept ACK

More MiniWallet is better.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

Left some comments

Comment on lines 145 to 146
utxo_1 = miniwallet.get_utxo()
miniwallet.send_self_transfer(from_node=node, utxo_to_spend=utxo_1)['txid']
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
utxo_1 = miniwallet.get_utxo()
miniwallet.send_self_transfer(from_node=node, utxo_to_spend=utxo_1)['txid']
miniwallet.send_self_transfer(from_node=node)['txid']

should be identical

Copy link
Member

Choose a reason for hiding this comment

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

Also, why the ['txid'] in the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the unnecessary ['txid']. The suggestion is not identical, since miniwallet.send_self_transfer sorts the utxo set by the value, before choosing a transaction.

maxfeerate=0,
)

self.log.info('A transaction with no outputs')
tx = tx_from_hex(raw_tx_reference)
tx = tx_from_hex(tx_reference['hex'])
tx.vout = []
# Skip re-signing the transaction for context independent checks from now on
Copy link
Member

Choose a reason for hiding this comment

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

Can also remove this line, because there are no signatures

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tx.vout = [] is necessary since the transaction is serialized in check_mempool_result. Without this, the transaction does not get rejected for the right reasons. Please let me know if I misunderstood the suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

I meant the comment line 😅

sriramdvt and others added 2 commits September 1, 2021 12:04
Replaced all wallet functionality in `test/functional/mempool_accept.py` to use `test/functional/test_framework/wallet.py` instead of the wallet built with Bitcoin Core.

Co-authored-by: Sishir Giri <sishirg27@gmail.com>
Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
@sriramdvt
Copy link
Contributor Author

Rebased and updated with the suggestions

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 9, 2021

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@laanwj
Copy link
Member

laanwj commented Dec 17, 2021

Unfortunately this needs significant changes due to changes to the affected tests since. Are you still planning to address this?

@sriramdvt sriramdvt marked this pull request as draft December 17, 2021 19:25
@sriramdvt
Copy link
Contributor Author

@laanwj Thank you for the reminder! I've edited it to be a draft PR in the meanwhile, I will address the changes in a few days and change the status.

@theStack
Copy link
Contributor

mempool_accept.py is already using MiniWallet on master, i.e. this PR should be closed.

@maflcko
Copy link
Member

maflcko commented Mar 23, 2022

Right, see commit 807169e

@bitcoin bitcoin locked and limited conversation to collaborators Mar 23, 2023
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.

7 participants