Lots of small fixes:
- moving unit tests to test_framework implementation files
- renaming functions to be clearer
- removing multiple imports
- removing unreadable byte literals from the code
- fixing pep8 violations
- correcting out-of-date docstring
Lots of small fixes:
I ran test_runner.py
on mac os 10.15.5 and all the tests changed in this PR passed!
I did fail wallet_keypool_topup.py --descriptors
See the logs below. I am not sure if this related to the changes in this PR.
test38failure.txt
I reviewed all the changes, and it all looks good to me, except for a small detail, please see question inline.
115+ self.assertEqual(hrp, "bcrt")
116+ (witver, witprog) = decode_segwit_address(hrp, addr)
117+ self.assertEqual(encode_segwit_address(hrp, witver, witprog), addr)
118+
119+ test_python_bech32('bcrt1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3xueyj')
120+ test_python_bech32('bcrt1qft5p2uhsdcdc3l2ua4ap5qqfg4pjaqlp250x7us7a8qqhrxrxfsqseac85')
ADDRESS_BCRT1_UNSPENDABLE
and ADDRESS_BCRT1_P2WSH_OP_TRUE
constants from address.py
here.
I’m wondering if it would be better to use the
ADDRESS_BCRT1_UNSPENDABLE
andADDRESS_BCRT1_P2WSH_OP_TRUE
constants fromaddress.py
here.
Good idea!
I would do this if the ADDRESS_BCRT_*
constants were in segwit_addr.py. address.py imports from segwit_addr.py, so adding importing these constants from address.py would be a circular dependency. Other options:
ADDRESS_BCRT
to see which test files import these constants from address.py)67@@ -68,6 +68,7 @@
68
69 TEST_FRAMEWORK_MODULES = [
70 "address",
71+ "segwit_addr",
ACK modulo #19253 (review)
The pep8, docstring and imports tidy-ups can probably be one clean-up commit.
I did fail wallet_keypool_topup.py –descriptors See the logs below. I am not sure if this related to the changes in this PR.
I don’t think it’s related. I’m able to run that test successfully on this branch.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
No conflicts as of last run.
These functions can be exported to other modules,
so be explicit that they're encoding and decoding
segwit addresses
This optional parameter is never used, so remove it.
No need to import twice from util.py
It's almost impossible to read bytes literals in code, so replace them
with the hex string literal and then convert them to a bytes object
using bytes.fromhex().
re-ACK 825fcae484f31182041dfacbf820e818d759b130 per git range-diff a0a422c 7edcdcd 825fcae
and verified wallet_address_types.py
and wallet_basic.py --descriptors
(the failure on one travis job) are green locally.
Good catch, Marco, on the p2wpkh address test.