Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address_to_script_pubkey doesn't support regtest segwit prefix #148

Open
bucko13 opened this issue May 22, 2023 · 4 comments
Open

address_to_script_pubkey doesn't support regtest segwit prefix #148

bucko13 opened this issue May 22, 2023 · 4 comments

Comments

@bucko13
Copy link

bucko13 commented May 22, 2023

Trying to build a psbt that's spending to a segwit regtest address results in the following error:

'unknown type of address: bcrt1q26ezj5pth4ta44eku3vmpvnejmsrhkfusczl83xlts5nkzyu3heqdzfqxa',

presumably expanding the check here to something like:

    elif s[:4] in ("bc1q", "tb1q") or s[:6] == "bcrt1q":

is that all that would be needed?

@mflaxman
Copy link
Collaborator

mflaxman commented Jun 4, 2023

Sorry for the delay!

That makes sense to me, although I'm not much of a regtest-er so not 100% sure. Did you try it against a specific unit test?

@bucko13
Copy link
Author

bucko13 commented Jun 4, 2023

Develop on mainnet or bust! 😂

I didn’t have a chance to try it out yet unfortunately. This was just drive by debugging developing with buidl as a dependency.

@nafisalawalidris
Copy link

The error message suggests that the address format is not being recognised by the code you're working with. Your suggestion to expand the address format check seems reasonable. If you believe that the bcrt1q prefix is valid for SegWit regtest addresses and you want to add support for it, you could modify the address format check as you've proposed:

elif s[:4] in ("bc1q", "tb1q") or s[:6] == "bcrt1q":

This change would include support for both SegWit mainnet (bc1q) and SegWit testnet (tb1q) addresses as well as SegWit regtest (bcrt1q) addresses.

@AlphonseMehounme
Copy link

The 'bcrt1q' prefix is valid for Segwit regtest addresses. I can suggest the update as stated above.

@mflaxman can I handle it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants