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 segwit API #120

Merged
merged 2 commits into from
Aug 16, 2023
Merged

Add segwit API #120

merged 2 commits into from
Aug 16, 2023

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Aug 2, 2023

Add a segwit API with the aim that "typical" modern bitcoin usage is easy and correct.

Done in a separate module so as not to impact the main crate API.

@tcharding tcharding changed the title WIP: Add segwit API Add segwit API Aug 2, 2023
@tcharding tcharding force-pushed the 08-02-segwit-api branch 2 times, most recently from 4a50ff2 to db7144e Compare August 2, 2023 01:05
@tcharding tcharding force-pushed the 08-02-segwit-api branch 2 times, most recently from 3c7e229 to d45699f Compare August 3, 2023 04:30
@tcharding
Copy link
Member Author

Hey @apoelstra check this out, its so-hot-right-now :)

@apoelstra
Copy link
Member

Nice! d45699f looks pretty good. I have some nits about the comments, mainly. Think this can be undrafted.

@tcharding
Copy link
Member Author

Cool, I'll go over it again today (after I fix the uppercase QR code thing) and undraft. Want to put this in before the alpha release?

@apoelstra
Copy link
Member

Yeah, let's get it in before alpha. We're pretty close.

@tcharding tcharding marked this pull request as ready for review August 4, 2023 01:38
@tcharding tcharding mentioned this pull request Aug 1, 2023
examples/qr_codes.rs Outdated Show resolved Hide resolved
src/segwit.rs Outdated Show resolved Hide resolved
src/segwit.rs Outdated Show resolved Hide resolved
src/segwit.rs Outdated Show resolved Hide resolved
Add a segwit API with the aim that "typical" modern bitcoin usage is
easy and correct.
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 6c1379b

@tcharding
Copy link
Member Author

Thanks for the review @clarkmoody!

src/segwit.rs Outdated
Comment on lines 104 to 110
encode(hrp, segwit::VERSION_0, witness_program)
}

/// Encodes a segwit version 1 address.
#[cfg(feature = "alloc")]
pub fn encode_v1(hrp: &Hrp, witness_program: &[u8]) -> Result<String, EncodeError> {
encode(hrp, segwit::VERSION_1, witness_program)
Copy link
Member

Choose a reason for hiding this comment

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

No need for segwit:: scoping here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I umm'ed and ahhh'ed about that line, whether the "segwit" added anything, will remove.

Copy link
Member

@clarkmoody clarkmoody left a comment

Choose a reason for hiding this comment

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

ACK bcc8506

Add two field element consts for segwit version 0 an version 1. This
makes reading the code much easier since one does not have to remember p
ad q.
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 024ed01

@apoelstra apoelstra merged commit f52be3d into rust-bitcoin:master Aug 16, 2023
12 checks passed
@apoelstra apoelstra deleted the 08-02-segwit-api branch August 16, 2023 15:02
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.

3 participants