-
Notifications
You must be signed in to change notification settings - Fork 698
fix: add regtest hrp for segwit bitcoin address #6373
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
fix: add regtest hrp for segwit bitcoin address #6373
Conversation
I think this is fine for now.
The reason we don't is because there's not much the client can do based on the decoding error. A string either decodes to a
That's okay. For now, the focus is on getting regtest HRP support for |
457ec9e
to
76bd51a
Compare
Got it. I was just asking because it could be useful to have an error message in case deserialization of addresses fails in the new RPC Client. Just In case, I have the patch ready for this (not pushed yet) That said, I’m also fine with keeping the current implementation as-is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
495fe91
Codecov Report❌ Patch coverage is ❌ Your project status has failed because the head coverage (76.23%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #6373 +/- ##
============================================
+ Coverage 62.44% 76.23% +13.78%
============================================
Files 552 552
Lines 351797 351925 +128
============================================
+ Hits 219676 268277 +48601
+ Misses 132121 83648 -48473
... and 379 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Description
This PR allows
BitcoinAddress
to manage segwit addresses for regtest (hrp = "bcrt").The following apis, now works nicely with regtest hrp:
SegwitBitcoinAddress::from_bech32(..)
BitcoinAddress::from_string(..)
Applicable issues
BitcoinAddress
to represent addresses with Regtest HRP prefix #6366Additional info (benefits, drawbacks, caveats)
Convert from Option to Result?
LegacyBitcoinAddress::from_b58(str)
already use Result.Possibly, we could then propagate Result to Address::from_string()
stacks-core/stackslib/src/burnchains/bitcoin/address.rs
Lines 302 to 307 in 9d53951
PoxAddress related
Current patch is applying a fallback that convert back and forth:
is_mainnet (bool) <=> NetworkType
stacks-core/stackslib/src/chainstate/stacks/address.rs
Lines 379 to 399 in 9d53951
stacks-core/stackslib/src/chainstate/stacks/address.rs
Lines 443 to 460 in 9d53951
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml