--valgrind
(18s vs 14s)
test: Speed up mempool_spend_coinbase.py #21762
pull MarcoFalke wants to merge 4 commits into bitcoin:master from MarcoFalke:2104-testSpeed changing 4 files +43 −27-
MarcoFalke commented at 7:58 am on April 23, 2021: memberLocally the test will run 4 seconds faster with
-
test: Add MiniWallet.sendrawtransaction
Can be reviewed with --ignore-all-space --color-moved=dimmed-zebra
-
test: Create MiniWallet.create_self_transfer fa085b470a
-
test: Fix test cache issue
The documentation did not match the implementation, no coins were mined to the OP_TRUE address.
-
test: Speed up mempool_spend_coinbase.py fa40eb5b6b
-
fanquake added the label Tests on Apr 23, 2021
-
DrahtBot commented at 11:18 am on April 23, 2021: member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #21178 (test: run mempool_reorg.py even with wallet disabled by DariusParvin)
- #21014 (test: Run mempool_accept.py even with wallet disabled by stackman27)
- #20874 (test: Run mempool_limit.py even with wallet disabled by stackman27)
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.
-
mjdietzx commented at 5:02 pm on April 28, 2021: contributor
- I really like the implementation of
sendrawtransaction
in https://github.com/bitcoin/bitcoin/pull/21762/commits/fa1bedb4944b513a3c9184ad549f58bfbe69e20e. I can close #20889 (review) in favor of this, right? - Also like the implementation of
create_self_transfer
and how it’s used 👍 in https://github.com/bitcoin/bitcoin/pull/21762/commits/fa085b470a9647f3b261f506b46f4e7ca2baf0b0 - I’m confused and still trying to understand what’s really going on here https://github.com/bitcoin/bitcoin/pull/21762/commits/fa29382ab23d52b86bfda8a267195b6c51b713c2. I see why the original implementation was really confusing (no coins ever mined to
ADDRESS_BCRT1_P2WSH_OP_TRUE
although the code makes you expect that to happen). But I don’t really get why the assertion changes from250
to248
assuming it wasn’t already failing. And I also don’t understand why it fits into this PR. Any explanation here could help me get to an ACK quicker - Nice speedup results in https://github.com/bitcoin/bitcoin/pull/21762/commits/fa40eb5b6bfd151912c58d61771f6a6528f44e67. Am I correct that
wallet.generate(200)
is what is slowing theseMiniWallet
tests down? And that the approach you use here would be the gold standard for otherMiniWallet
tests going forward?
- I really like the implementation of
-
MarcoFalke commented at 5:10 pm on April 28, 2021: member
But I don’t really get why the assertion changes from 250 to 248 assuming it wasn’t already failing. And I also don’t understand why it fits into this PR. Any explanation here could help me get to an ACK quicker
I don’t know either why the assertion is there, but the value changes because the block size changes due to the scriptPubKey (size) change.
Am I correct that wallet.generate(200) is what is slowing these MiniWallet tests down? And that the approach you use here would be the gold standard for other MiniWallet tests going forward?
Yes,
generate
will take time under valgrind, so using the cache when possible will help with a speed-up. Though it is not always possible to use the cache. -
in test/functional/mempool_spend_coinbase.py:38 in fa40eb5b6b
41- utxo_101 = wallet.get_utxo(txid=coinbase_txids[0]) 42- utxo_102 = wallet.get_utxo(txid=coinbase_txids[1]) 43+ wallet.scan_blocks(start=chain_height - 100 + 1, num=1) 44+ utxo_mature = wallet.get_utxo() 45+ wallet.scan_blocks(start=chain_height - 100 + 2, num=1) 46+ utxo_immature = wallet.get_utxo()
mjdietzx commented at 5:21 pm on April 28, 2021:I don’t really like this pattern. The method name
sync_blocks
seems confusing because I wouldn’t expect a state change (self._utxos
) by this method. It seems this would have to be used very carefully, with knowledge ofMiniWallet
’s internals to avoid bugs. For example, ifscan_blocks
is called multiple times with any overlapping blocks, then we’ll start to get duplicate utxos inself._utxos
(maybe this should be a set instead of a list)?In general I also don’t really like how
self._utxos
is sorted (insend_self_transfer
by value), while here it isn’t sorted but will have an implicit ordering based on when/howscan_blocks
is called, and then based on order of blocks/vouts insidescan_blocks
. There’s just a lot of different ways it’s ordered and we are always relying on that orderingI’m gonna think this through, don’t think this should hold up this PR. But at least I can start the discussion and see what you think / if this can be improved.
MarcoFalke commented at 5:24 pm on April 28, 2021:I agree. Do you have specific suggestions to improve that pass with all existing tests? Feel free to ping me for review.mjdietzx commented at 5:22 pm on April 28, 2021: contributorMarcoFalke merged this on Apr 29, 2021MarcoFalke closed this on Apr 29, 2021
MarcoFalke deleted the branch on Apr 29, 2021sidhujag referenced this in commit e18347face on Apr 29, 2021gwillen referenced this in commit 6b565b9878 on Jun 1, 2022DrahtBot locked this on Aug 16, 2022Labels
Tests
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-23 12:12 UTC
More mirrored repositories can be found on mirror.b10c.me