Summary
- Extend
test/functional/test_framework/address.py::address_to_scriptpubkeyto support mainnet Base58 version bytes:- P2PKH:
0 - P2SH:
5
- P2PKH:
- Replace assert-based Base58 character validation with explicit
ValueError. - Add explicit
ValueErrorhandling for:- empty input
- unsupported Base58 version bytes
- invalid payload lengths
Motivation
address_to_scriptpubkey supported Bech32 and testnet Base58, but not mainnet Base58 (0, 5), despite being a shared helper in functional tests.
This change closes that gap and makes failure modes explicit and testable.
Tests
cd test/functional && python3 -m unittest test_framework.addresstest/functional/feature_framework_unit_tests.pypython3 -m ruff check --select=B006,B008,E101,E401,E402,E701,E702,E703,E711,E713,E714,E721,E722,E742,E743,F401,F402,F403,F404,F405,F406,F407,F541,F601,F602,F621,F631,F632,F811,F821,F822,F823,F841,PLE,W191,W291,W292,W293,W605 test/functional/test_framework/address.py