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 remove_partial_sigs and try_finalize to SignOptions #621

Conversation

kafaichoi
Copy link
Contributor

@kafaichoi kafaichoi commented Jun 4, 2022

Description

This PR is to add 2 keys(try_finalize and remove_partial_sigs) in SignOptions. See this issue for detail #612

Notes to the reviewers

I found the negative naming of these 2 new keys do_not_finalize and do_not_remove_partial_sigs are a bit confusing(like most negative named paremeter/variable). Should we actually change it back to positive naming(do_finalize and do_remove_partial_sigs)?

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature
  • I've updated CHANGELOG.md

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@kafaichoi kafaichoi changed the title Remove partial signature after finalizing psbt Add do_not_finalize and do_not_remove_partial_sigs to SignOptions Jun 4, 2022
@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch from 47642ff to 4bbb9ac Compare June 4, 2022 08:10
src/wallet/mod.rs Outdated Show resolved Hide resolved
@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch from 4bbb9ac to e272a14 Compare June 5, 2022 02:43
@notmandatory
Copy link
Member

I agree do_not makes the naming and and logic overly complicated, would be clearer as do_finalize and do_remove_partial_sigs, or how about try_finalize (since it may not be able to) and remove_partial_sigs.

Copy link
Member

@danielabrozzoni danielabrozzoni left a comment

Choose a reason for hiding this comment

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

Concept ACK, the code looks good!
I have a couple of comments.

I agree that the current names are a bit confusing, I really like Steve's try_finalize/remove_partial_sigs suggestion :)

src/wallet/mod.rs Outdated Show resolved Hide resolved
src/wallet/mod.rs Outdated Show resolved Hide resolved
@@ -665,8 +665,15 @@ pub struct SignOptions {
/// Whether the signer should use the `sighash_type` set in the PSBT when signing, no matter
/// what its value is
///
/// Defaults to `false` which will only allow signing using `SIGHASH_ALL`.
/// Defaults to `false` which will remove partial_sigs after input is signed
Copy link
Member

Choose a reason for hiding this comment

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

It looks like you've accidentally modified allow_all_sighashes docs...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦my bad

@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch from e272a14 to 09d4bc6 Compare June 9, 2022 06:42
@kafaichoi kafaichoi changed the title Add do_not_finalize and do_not_remove_partial_sigs to SignOptions Add remove_partial_sigs and try_finalize to SignOptions Jun 9, 2022
@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch 4 times, most recently from c018a7a to c324eb1 Compare June 9, 2022 07:50
Copy link
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

tACK c324eb1

Just few nits..

Comment on lines 3914 to 3915
// remove finalized input partial_sigs if remove_partial_sigs is set as true in SignOptions
// do not remove finalized input partial_sigs if remove_partial_sigs is set as false in SignOptions.
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this comment is redundant.. It self evident from the statement below what its trying to do.

Comment on lines 670 to 672
/// Whether partial_sigs in input should be removed when the psbt inputs are signed in finalizing psbt.
///
/// Defaults to `true` which will remove partial_sigs in inputs after signing.
Copy link
Contributor

Choose a reason for hiding this comment

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

Small doc nit. This sentences can be simplified a little.

Suggested change
/// Whether partial_sigs in input should be removed when the psbt inputs are signed in finalizing psbt.
///
/// Defaults to `true` which will remove partial_sigs in inputs after signing.
/// Whether to remove partial_sigs from psbt inputs while finalizing psbt.
///
/// Defaults to `true` which will remove partial_sigs after finalizing.

@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch 3 times, most recently from 726a14d to be8c9dc Compare June 11, 2022 08:48
Copy link
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

tACK be8c9dc

All looks good to me.. Just one minor nit..

CHANGELOG.md Outdated
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Signing Taproot PSBTs (key spend and script spend)
- Support for `tr()` descriptors in the `descriptor!()` macro
- Add support for Bitcoin Core 23.0 when using the `rpc` blockchain
- Added `remove_partial_sigs` and `try_finalize` to `SignOptions`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Added `remove_partial_sigs` and `try_finalize` to `SignOptions`
- Add `remove_partial_sigs` and `try_finalize` to `SignOptions`

@danielabrozzoni
Copy link
Member

Can you please rebase on master, to pick up the CI changes? :)

@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch 2 times, most recently from 46a2f4e to 5eac541 Compare June 29, 2022 05:39
@danielabrozzoni
Copy link
Member

tACK 5eac541

Copy link
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch from 5eac541 to 6a79f39 Compare July 2, 2022 06:30
@kafaichoi
Copy link
Contributor Author

tACK 5eac541

modulo https://github.com/bitcoindevkit/bdk/pull/621/files#r895010365

Sorry for replying it previously. I saw some places using "added" so I didn't change it. But yea happy to change that if that's way we want :)

Copy link
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

Sorry for replying it previously. I saw some places using "added" so I didn't change it. But yea happy to change that if that's way we want :)

No issues, not a big deal..

ACK 6a79f39

Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

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

utACK 6a79f39

@kafaichoi kafaichoi force-pushed the remove-partial-signature-after-finalizing-psbt branch from 6a79f39 to e3a17f6 Compare July 6, 2022 10:13
Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

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

ReACK e3a17f6

@notmandatory notmandatory merged commit dd51380 into bitcoindevkit:master Jul 6, 2022
@notmandatory
Copy link
Member

I noticed the CHANGELOG message ended up in the wrong place, I'll fix it in the release branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants