Skip to content

Refactor and simplify how private/public keys are tweaked for taproot spends#169

Closed
sstone wants to merge 2 commits intomasterfrom
refactor_p2tr_tweaks
Closed

Refactor and simplify how private/public keys are tweaked for taproot spends#169
sstone wants to merge 2 commits intomasterfrom
refactor_p2tr_tweaks

Conversation

@sstone
Copy link
Member

@sstone sstone commented Dec 8, 2025

  • We should not expose a Script.pay2tr() methods that sends to a raw untweaked key. It's confusing and users should never need it anyway.
  • SchnorrTweak.NoTweak was not needed, it is simpler to just use an optional tweak when signing with the private key

… spends

- We should not expose a Script.pay2tr() methods that sends to a raw untweaked key. It's confusing and users should never need it anyway.
- SchnorrTweak.NoTweak was not needed, it is simpler to just use an optional tweak when signing with the private key
@sstone sstone force-pushed the refactor_p2tr_tweaks branch from c7ded30 to d817d31 Compare December 8, 2025 15:57
Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

Good idea, the empty p2tr() function was indeed a frequent source of bugs! I only have one comment about the default constructor for a TaprootTweak, which reintroduces the same kind of footgun (which you only use for convenience inside this repository, which isn't worth the risk of footgun).

Users now have to explicitly create a KeyPath or ScriptPath tweak.
Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

LGTM! As pointed out in ACINQ/secp256k1-kmp#136, I think it's worth preparing draft PRs all the way up to eclair and lightning-kmp to ensure that everything works before going through a chain of releases?

@sstone
Copy link
Member Author

sstone commented Dec 15, 2025

Replaced by #170

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