Support bech32 addresses in rpc methods#211
Merged
dangershony merged 1 commit intoblock-core:masterfrom Sep 2, 2020
Merged
Conversation
dangershony
reviewed
Sep 2, 2020
| // Currently segwit and bech32 addresses are not supported. | ||
| if (!addressType.Equals("legacy", StringComparison.InvariantCultureIgnoreCase)) | ||
| throw new RPCServerException(RPCErrorCode.RPC_METHOD_NOT_FOUND, "Only address type 'legacy' is currently supported."); | ||
| // Currently segwit addresses are not supported. |
Member
There was a problem hiding this comment.
Doesn't Bech32 imply segwit?
Contributor
Author
There was a problem hiding this comment.
Maybe should clarify as p2sh-segwit addresses are not supported. Not sure we need to worry about them as bech32 seems to have been well adopted
Member
|
Looks fine to me @sondreb ? |
dangershony
approved these changes
Sep 2, 2020
sondreb
reviewed
Sep 2, 2020
| return new NewAddressModel(base58Address); | ||
| string address = hdAddress.Address; // legacy address | ||
| if (addressType != null && addressType.Equals("bech32", StringComparison.InvariantCultureIgnoreCase)) | ||
| address = hdAddress.Bech32Address; |
Member
There was a problem hiding this comment.
This could be simplified to avoid performing two get operations every time the user request bech32 address. The assignment should depend on the conditional check.
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.
Update getnewaddress and getunsusedaddress RPC calls to support returning bech32 addresses
Fixes #101