Skip to content

Implement Readable for Bolt12Invoice #3143

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

Conversation

TheBlueMatt
Copy link
Collaborator

In c13b6d8 and
fc14495 we implemented Readable for Refund and Offers, but didn't do so for Bolt12Invoice.

Because Bolt12Invoices are not serializable to strings, we generally expect users to read and write them as byte arrays, and currently expose this via TryFrom<Vec<u8>>. This is fine, but there's no reason to not implement Readable as well, and it saves having to implement TryFrom in bindings.

In c13b6d8 and
fc14495 we implemented `Readable`
for `Refund` and `Offer`s, but didn't do so for `Bolt12Invoice`.

Because `Bolt12Invoice`s are not serializable to strings, we
generally expect users to read and write them as byte arrays, and
currently expose this via `TryFrom<Vec<u8>>`. This is fine, but
there's no reason to not implement `Readable` as well, and it
saves having to implement `TryFrom` in bindings.
@@ -1160,6 +1160,13 @@ impl TryFrom<Vec<u8>> for Bolt12Invoice {
}
}

impl Readable for Bolt12Invoice {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already implemented on line 1122 as part of #3078.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh sorry, I missed that 🤦

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

Successfully merging this pull request may close these issues.

2 participants