Skip to content

Conversation

@w0xlt
Copy link
Contributor

@w0xlt w0xlt commented Sep 2, 2022

This PR refactors RPCPackagesTest to use MiniWallet and removes create_child_with_parents, make_chain, and create_raw_chain from test_framework/wallet, as requested in #25965.

Close #25965.

Copy link
Contributor

@kouloumos kouloumos left a comment

Choose a reason for hiding this comment

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

The reasoning behind the removal of those functions was that the functionality of those methods can now be replicated with the existing MiniWallet methods.

I believe that your implementation doesn't fully utilize the MiniWallet methods. See #25379 where I did the first part of refactoring mempool_package_limits.py which was the other test that was using those functions.

@w0xlt w0xlt force-pushed the issue_25965 branch 2 times, most recently from 941ae7f to 10edc9c Compare September 3, 2022 08:23
@w0xlt
Copy link
Contributor Author

w0xlt commented Sep 3, 2022

@kouloumos Thanks for the tip. I changed all tests to use MiniWallet methods in 10edc9c0d7b686808c040204103da01ed386a3c9.

Copy link
Contributor

@kouloumos kouloumos left a comment

Choose a reason for hiding this comment

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

Looks good, some minor comments

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 3, 2022

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK glozow, pablomartin4btc, kouloumos
Approach ACK hernanmarino, rserranon

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26403 ([POLICY] Ephemeral anchors by instagibbs)
  • #25038 (policy: nVersion=3 and Package RBF by glozow)

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.

@w0xlt w0xlt force-pushed the issue_25965 branch 2 times, most recently from df7e74b to 4d4298f Compare September 3, 2022 20:19
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for working on this!

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

ACK 17cad44

@glozow glozow requested a review from kouloumos November 17, 2022 19:35
Copy link
Contributor

@hernanmarino hernanmarino left a comment

Choose a reason for hiding this comment

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

Approach ACK

Copy link
Member

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

tested ACK 17cad44; went thru all changes and recommendations from @kouloumos & @glozow; also went up to #20833 to get a bit of background of the origin and purpose of these tests.

Copy link
Contributor

@kouloumos kouloumos left a comment

Choose a reason for hiding this comment

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

ACK 17cad44
looks good to me, just some minor nits.

Comment on lines +91 to +92
address = node.get_deterministic_priv_key().address
garbage_tx = node.createrawtransaction([{"txid": "00" * 32, "vout": 5}], {address: 1})
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: get_deterministic_priv_key is not often used alongside the MinWallet is used. Why not use its own method?

Suggested change
address = node.get_deterministic_priv_key().address
garbage_tx = node.createrawtransaction([{"txid": "00" * 32, "vout": 5}], {address: 1})
address = self.wallet.getaddress()
garbage_tx = node.createrawtransaction([{"txid": "00" * 32, "vout": 5}], {address: 1})

Also, if you decide to touch this, garbage_tx_hex follows better the naming scheme.

Comment on lines +224 to +225
{"txid": tx1["txid"], "wtxid": tx1["wtxid"], "package-error": "conflict-in-package"},
{"txid": tx1["txid"], "wtxid": tx1["wtxid"], "package-error": "conflict-in-package"}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I believe that is for the best when similar implementation details follow similar checks in code across functional tests. Although I believe this is important, I consider it a nit as this is not code you've written as part of this refactor.

What I am referring to, is the assertion after a testmepoolaccept(). In a similar example at mempool_package_limits, the implementation logic differs a bit and imo improves the readability by not checking for (w)txid.

testres_too_long = node.testmempoolaccept(rawtxs=package_hex)
for txres in testres_too_long:
assert_equal(txres["package-error"], "package-mempool-limits")

Just a note that a similar assertion-of-testmepoolaccept() logic is already a method as part of another test. I've tried to implement it as part of this test, but it ended up not worth it.

def check_mempool_result(self, result_expected, *args, **kwargs):
"""Wrapper to check result of testmempoolaccept on node_0's mempool"""
result_test = self.nodes[0].testmempoolaccept(*args, **kwargs)
for r in result_test:
r.pop('wtxid') # Skip check for now
assert_equal(result_expected, result_test)
assert_equal(self.nodes[0].getmempoolinfo()['size'], self.mempool_size) # Must not change mempool state

*This assertion-of-testmepoolaccept() pattern can be observed in multiple occasions, this highlights just one of them.

Copy link
Member

Choose a reason for hiding this comment

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

Agree doing similar checks each time is good and having a helper like check_mempool_result() is a way to achieve that. Fine for a future PR.

Comment on lines -387 to -388
# 2 parent 1 child CPFP. First parent pays high fees, second parent pays 0 fees and is
# fee-bumped by the child.
Copy link
Contributor

Choose a reason for hiding this comment

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

comment good

@rserranon
Copy link

Approach ACK

@glozow glozow merged commit 00c3236 into bitcoin:master Nov 28, 2022
@w0xlt w0xlt deleted the issue_25965 branch November 28, 2022 18:43
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 1, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Nov 28, 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.

remove create_child_with_parents, make_chain, and create_raw_chain from test_framework/wallet

8 participants