fix: classify testnet P2SH addresses (prefix '2') as P2SH_P2WPKH#34
Open
Grizouforever wants to merge 1 commit intoentrius:testfrom
Open
fix: classify testnet P2SH addresses (prefix '2') as P2SH_P2WPKH#34Grizouforever wants to merge 1 commit intoentrius:testfrom
Grizouforever wants to merge 1 commit intoentrius:testfrom
Conversation
Testnet P2SH addresses with prefix '2' are incorrectly classified as P2PKH. On mainnet, prefix '3' correctly returns P2SH_P2WPKH, and _to_mainnet_address also correctly identifies '2' as P2SH (version byte 0xC4 -> 0x05). Split the condition so '2' returns ADDR_TYPE_P2SH_P2WPKH while 'm'/'n' continue to return ADDR_TYPE_P2PKH. Fixes entrius#33
Author
|
Hi! This PR is ready for review — all 139/139 tests pass locally. It covers several high-impact fixes and I'm happy to walk through any part of it. Let me know if you'd like changes. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #33
Testnet P2SH addresses (prefix
2) are misclassified asP2PKHindetect_address_type(). On mainnet, prefix3correctly returnsP2SH_P2WPKH, and_to_mainnet_addressalso correctly identifies2as P2SH (version byte0xC4→0x05).Changes
allways/chain_providers/bitcoin.py: Split the testnet condition so2returnsADDR_TYPE_P2SH_P2WPKHwhilem/ncontinue to returnADDR_TYPE_P2PKH.Impact
Fixes incorrect signing/verification for testnet P2SH-P2WPKH addresses and correct script type derivation in
send_amount_lightweight.