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

Add XpubDerivable constructors #28

Merged
merged 3 commits into from
Jun 8, 2024
Merged

Add XpubDerivable constructors #28

merged 3 commits into from
Jun 8, 2024

Conversation

dr-orlovsky
Copy link
Member

Closes #27

@dr-orlovsky dr-orlovsky added the enhancement New feature or request label May 24, 2024
@dr-orlovsky dr-orlovsky added this to the v0.11.0 milestone May 24, 2024
@dr-orlovsky dr-orlovsky requested a review from zoedberg May 24, 2024 16:57
@dr-orlovsky dr-orlovsky self-assigned this May 24, 2024
Copy link
Contributor

@zoedberg zoedberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't close #27 since in descriptor-wallet there's no Xpub nor XpubSpec

@dr-orlovsky
Copy link
Member Author

dr-orlovsky commented May 30, 2024

There is no trivial way of converting this two things; and since descriptor-wallet will be eventually replaced by bp-wallet, I do not think it worth spending a lot of time on this.

Currently you can use conversion between ExtendedPubkey and Xpub not through a string but through a fixed-size array serialization, which is supported by both and is ultra-performant. This PR makes field non-private and unlocks ability to use it.

@zoedberg
Copy link
Contributor

zoedberg commented Jun 3, 2024

Thanks for the suggestion, I'm now able to get an XpubDerivable starting from a DerivationAccount without having to manipulate any string. It requires quite a lot of code but since this should be temporary I think it's acceptable.

Just a couple of requests:

  • is it possible to remove the &'static lifetime from the keychains param?
  • could you move this PR on top of the master branch please?

@dr-orlovsky
Copy link
Member Author

is it possible to remove the &'static lifetime from the keychains param?

no, since it uses From<'static ...> for DervationSeg, which requires static since it panics if the length is wrong - and it means that I would need to change it to TryFrom and return error from with if a static type is not used. Why do you need it to be removed?

could you move this PR on top of the master branch please?

done

@dr-orlovsky
Copy link
Member Author

@zoedberg I have added XpubDerivable::try_custom constructor which doesn't require a static argument, but which can fail. I have also renamed other constructor methods

@dr-orlovsky dr-orlovsky merged commit 8177aab into master Jun 8, 2024
18 checks passed
@dr-orlovsky dr-orlovsky deleted the derivable branch September 5, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

obtain a XpubDerivable without manual string manipulation
2 participants