Repository navigation
Accept uniformly uppercase SegWit addresses - #545
Open
36taransingh5-dotcom wants to merge 2 commits into
Open
36taransingh5-dotcom wants to merge 2 commits into
36taransingh5-dotcom wants to merge 2 commits into
Conversation
Normalize only uniformly cased ASCII SegWit strings, retaining rejection of mixed case and leaving legacy Base58 validation unchanged.
Cover uniformly uppercase and lowercase BIP 173 examples, mixed-case rejection, trailing newlines and Unicode case lookalikes.
This branch has not been deployed
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.
btc_address()rejects all-uppercase SegWit addresses, includingBC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4, a valid BIP 173 example. BIP 173 allows uppercase encodings for presentation and QR codes, while forbidding mixed case.Normalize only uniformly cased ASCII SegWit strings before applying the existing pattern. Mixed-case strings remain rejected, including case changes confined to the prefix or data. The ASCII check prevents Unicode case lookalikes from becoming accepted during normalization. Legacy Base58 validation is unchanged.
Tests cover four mainnet/testnet examples in both cases, six mixed-case inputs, trailing newlines, and Kelvin-sign lookalikes. The four uppercase regression cases fail before the change. This keeps the documented regex-only estimate for SegWit; it does not add checksum validation or claim full BIP compliance.
Validation on Linux, CPython 3.12.15:
git diff --checkpassed.Other Python versions and operating systems were not run locally. Hosted CI has not been verified.
Standard and vectors: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
Prepared and validated with AI assistance.