fix: classify testnet P2SH addresses (prefix '2') as P2SH-P2WPKH#42
Open
t7929375-eng wants to merge 1 commit intoentrius:testfrom
Open
fix: classify testnet P2SH addresses (prefix '2') as P2SH-P2WPKH#42t7929375-eng wants to merge 1 commit intoentrius:testfrom
t7929375-eng wants to merge 1 commit intoentrius:testfrom
Conversation
The '2' prefix was grouped with 'm'/'n' (P2PKH) but _to_mainnet_address already treats it as P2SH (version byte 0xC4 → 0x05). Split the condition so '2' returns ADDR_TYPE_P2SH_P2WPKH. Fixes entrius#33
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
Testnet addresses starting with
2(e.g.,2N5kNSL...) are P2SH-P2WPKH addresses, butdetect_address_type()incorrectly classifies them as P2PKH because they fall through the same branch asm/nprefixes.This fix separates the prefix
2check to returnADDR_TYPE_P2SH_P2WPKH, keepingm/nas P2PKH.Related Issues
Fixes #33
Type of Change
Testing
2), P2PKH (m), and P2PKH (n) prefixesChecklist
cc @anderdc @LandynDev