-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: Use MiniWallet in test_no_inherited_signaling RBF test #22210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fa621d8 to
fa59d50
Compare
|
Concept ACK Not strictly related to this PR, but: the parameter |
This is already done by the test framework in setup_nodes()
Can be reviewed with --ignore-all-space
fa59d50 to
fa7d71f
Compare
| self.nodes[0].generate(1) | ||
| self.sync_blocks() | ||
| wallet = MiniWallet(self.nodes[0]) | ||
| wallet.scan_blocks(start=76, num=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does the hardcoded 76 come from? It seems to me you just need a mature utxo here? If that's the case and I'm not missing anything, could you do something like: start=blockheight - COINBASE_MATURITY?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant is derived from
bitcoin/test/functional/test_framework/test_framework.py
Lines 736 to 748 in 96f828b
| # Create a 199-block-long chain; each of the 3 first nodes | |
| # gets 25 mature blocks and 25 immature. | |
| # The 4th address gets 25 mature and only 24 immature blocks so that the very last | |
| # block in the cache does not age too much (have an old tip age). | |
| # This is needed so that we are out of IBD when the test starts, | |
| # see the tip age check in IsInitialBlockDownload(). | |
| gen_addresses = [k.address for k in TestNode.PRIV_KEYS][:3] + [ADDRESS_BCRT1_P2WSH_OP_TRUE] | |
| assert_equal(len(gen_addresses), 4) | |
| for i in range(8): | |
| cache_node.generatetoaddress( | |
| nblocks=25 if i != 7 else 24, | |
| address=gen_addresses[i % len(gen_addresses)], | |
| ) |
| # Summary section. | ||
| # The original transaction (`optout_child_tx`) doesn't signal RBF but its parent (`optin_parent_txid`) does. | ||
| # The original transaction (`optout_child_tx`) doesn't signal RBF but its parent (`optin_parent_tx`) does. | ||
| # The replacement transaction (`replacement_child_tx`) should be able to replace the original transaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is my understanding here correct?
a) testmempoolaccept returns that replacement_child_tx is allowed even though it is rejected w/ 'txn-mempool-conflict'
b) getmempoolentry returns that optout_child_tx is 'bip125-replaceable' - as you descbribe in #22209 even though it is not
So does anything need to be done to fix a and b?
Another question I have (which maybe I should just try out). But, I wonder what would happen if you tried something like https://github.com/bitcoin/bitcoin/pull/22210/files#diff-260c479178e3e99a16798aeed39f400676894392864784eda6c207716704398dR584-R589 after optout_child_tx was already sent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) No, it is also rejected by testmempoolaccept, see mempool_valid=False for replacement_child_tx above.
b) correct
So does anything need to be done to fix a and b?
Maybe. But a fix should be done outside a test-only change.
|
Concept ACK: |
|
Tested ACK fa7d71f thanks for the explanations, nicely done |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
theStack
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fa7d71f 🍷
Follow-up idea based on discussion #22210 (comment): This will probably not the last test that needs the block number of the first output to ADDRESS_BCRT1_P2WSH_OP_TRUE (i.e. suitable for MiniWallet in its default mode of MiniWalletMode.ADDRESS_OP_TRUE). In the future it may makes sense to put the magic number 76 into a constant.
… feature_rbf.py aa02c64 test: use MiniWallet for simple doublespend test in feature_rbf.py (Sebastian Falbesoner) a3f6397 test: feature_rbf.py: make MiniWallet instance available for all sub-tests (Sebastian Falbesoner) 84c8747 test: remove unneeded initialization code in feature_rbf.py (Sebastian Falbesoner) Pull request description: This PR's goal is to prepare the functional test `feature_rbf.py` for more MiniWallet usage. It first gets rid of unused initialization code (I guess that was needed at times when the nodes were still in IBD at the start of tests?), then makes the MiniWallet instance introduced in #22210 available for all sub-tests, and finally, uses that instance in the first sub-test `test_simple_doublespend`. Note that the same idea of replacing the `make_utxo` calls with MiniWallet can be also applied to other sub-tests too; this just serves as a first proof-of-concept. ACKs for top commit: MarcoFalke: re-ACK aa02c64 🌯 Tree-SHA512: 2902dd15d493d83b0790028c92d14fbd99ca05ace704c7011fb38261ce6517aeb810ef9f360fcb701d95887975b6a2911cfe538858d38fceb2c1c2a40afdbe6b
This comes with nice benefits:
Also add some additional checks for
getmempoolentry(#22209) and other cleanups 🎨