support native segwit regtest addresses (#148)#162
Open
cc-unchained wants to merge 1 commit intobuidl-bitcoin:mainfrom
Open
support native segwit regtest addresses (#148)#162cc-unchained wants to merge 1 commit intobuidl-bitcoin:mainfrom
cc-unchained wants to merge 1 commit intobuidl-bitcoin:mainfrom
Conversation
Shadouts
suggested changes
Sep 26, 2024
buidl/script.py
Outdated
There was a problem hiding this comment.
I think this is fuzzy. I think a root-level branch specific for regtest would be better because a bc1q with length 64 should throw.
...
elif s[:4] in ("bc1q", "tb1q"):
if len(s) == 42:
# p2wpkh
return P2WPKHScriptPubKey(decode_bech32(s)[2])
elif len(s) == 62:
# p2wsh
return P2WSHScriptPubKey(decode_bech32(s)[2])
elif s[:6] == "bcrt1q":
if len(s) == 44:
# p2wpkh
return P2WPKHScriptPubKey(decode_bech32(s)[2])
elif len(s) == 64:
# p2wsh
return P2WSHScriptPubKey(decode_bech32(s)[2])
...
98d8fa8 to
70107fa
Compare
70107fa to
92a2549
Compare
92a2549 to
eb30d28
Compare
Collaborator
|
Are there plans to add regtest as a separate network parameter? There are a lot of functions that use network as a parameter and if we're to support regtest, they all need to be updated. For example bech32.py has a function encode_bech32_checksum. That would need to return the address of the type that is in this function. |
f1b34e0 to
eb30d28
Compare
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.
Add support for Native Segwit addresses on regtest networks
Resolves Issue #148
To verify this human readable part for bech32 regtest addresses, the following references may be helpful:
bitcoinjs-lib