-
Notifications
You must be signed in to change notification settings - Fork 37.8k
test: add rescan utxos
inside MiniWallet's initialization
#26886
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
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
a4244eb
to
9a39a9b
Compare
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.
Concept ACK
Nice idea, seems reasonable to automatically scan for relevant UTXOs on MiniWallet creation if that's what we need to do most of the times anyways. I was thinking if it's worth it to add an option to the constructor to prevent that (so that users could e.g. pass rescan=False
), but on the other hand a single additional scantxoutset
RPC should never be problematic at all, especially since the UTXO set would be likely empty in those cases anyways. Will do a detailled review tomorrow.
Yes, the UTXO set will be empty in those cases (when a clean chain is used) as at all times (except this one) the MiniWallet is initialized at the start of the test. Also, just a note that since #25445(fa13375) there is an additional |
9a39a9b
to
43ba876
Compare
Needs rebase after ac4c79a ? |
9f1cc01
to
e565d46
Compare
Rebased after ac4c79a and force-pushed to also remove the now redundant |
dfccf1d
to
cc50ef8
Compare
Rebased after d6fc1d6 and forced-pushed to remove the now redundant |
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 cc50ef8 🧹
Nice cleanup!
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.
Needs rebase cc50ef8 🚦
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Needs rebase cc50ef82646699f0be0e65dbd8b3a23aed57111b 🚦
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhk3wwAhDET3giO6sF+pFhfgZqbhyFKg2pK94RnqQvuXyu9iczaa0z82zXXe7O+
kJu06aVtKFmeZNp3iIR9821WFKSUQoHuYCEZXGKISppm2MRZ89wttPpKy1OdHxJ0
yEBpH8M+yMveucqMZ+20VgCTk7wvlJjUQsqADCYIUEdPsO6rdVXnudIKDVI5DRb9
5Az3/hJwTWyzXnKbu4CeKq4jCu5DbLFJtCWJb5hhgnnzAfhDdViGksQqzGhIn7jX
MrAMMHQbwkRYB08HdzvLpbEYbCwRFOZGYu4umt/wiBq18qsnfCQ3lsBOA/vlzljn
Ua/x3ChsoEFwvvKO72fQSYhRgS5Zj7b+HfXqhd8AWdMrKYaJKD1h6Aqb83z4xj8O
+aTwA/y2Mid4PWr47hU1VjWIhsp0rV6HizKpzLCxFPDOCfXCzczsxv0ZLBYseQfJ
NZ+SbQDsEHxG/efOApfRP+6LcS4pMtQZ3YFcoFaY++ajBmVNBmQ5ROhm4DRj/Md7
CC5I4huv
=Pv5e
-----END PGP SIGNATURE-----
this simplifies usage when MiniWallet is used with a pre-mined chain.
cc50ef8
to
68eefb4
Compare
those tests already have enough mature utxos from the pre-mined chain.
68eefb4
to
6bd098a
Compare
Rebased to resolve merge conflicts after d0a909a and forced-pushed to remove the now redundant blocks generation logic from |
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.
re-ACK 6bd098a
ACK 6bd098a 🕷 Show signatureSignature:
|
When a pre-mined blockchain is used (default behavior), it contains coinbase outputs in blocks 76-10 to the MiniWallet's default address. That's why we always*
rescan_utxos()
after initializing the MiniWallet, in order for the MiniWallet to account for those mature UTXOs.This PR adds
rescan_utxos()
inside MiniWallet's initialization to simplify usage when the MiniWallet is used with a pre-mined chain.secondary changes
*There are a few tests that use the pre-mined blockchain but do not
rescan_utxos()
, they instead generate new blocks to create mature UTXOs.After including
rescan_utxos()
inside MiniWallets initilization, this blocks generation logic is not needed as the MiniWallet already accounts for enough mature UTXOs to perform the tests. Therefore the now redundant blocks generation logic is removed from those tests with the second commit.The rest of the MiniWallet tests use a clean chain (
self.setup_clean_chain = True
) and can be seen withgit grep -n "MiniWallet(" $(git grep -le "self.setup_clean_chain = True")
From those, there are a few that start from a clean chain and then create enough mature UTXOs for the MiniWallet with this kind of logic:
bitcoin/test/functional/mempool_expiry.py
Lines 36 to 40 in 07c54de
Those tests are simplified in the third commit to instead utilize the mature UTXOs of the pre-mined chain.