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

SignPsbt over nested pay to witness public key hash fails to produce signature #6626

Closed
alexbosworth opened this issue Jun 7, 2022 · 0 comments · Fixed by #6687
Closed
Labels
psbt wallet The wallet (lnwallet) which LND uses
Milestone

Comments

@alexbosworth
Copy link
Contributor

Background

SignPsbt when using nested p2wpkh inputs does not produce signatures

Your environment

  • lnd v0.15.0-beta.rc4 (also 0.14.3-beta)

Steps to reproduce

  1. Create wallet that only has np2wpkh UTXOs
  2. Use FundPsbt to create a PSBT
  3. Call SignPsbt to get a signature

Expected behavior

Sign PSBT should produce a "partial signature", as it does for regular p2wpkh input signing requests, and it should produce no "final" elements since that is the role of the finalizer and this API is to be used for signature collection

Actual behavior

The redeem script is populated as final_scriptSig in the output, however there is no partial signature as there is for a p2wpkh input

Example input being passed to SignPsbt:

cHNidP8BAHECAAAAAQFAmHjw8l/MwVoQLiDqP4cuNZCMixc3hl0RS7Bw/WteAQAAAAAAAAAAAkBCDwAAAAAAFgAUC5b32IzmloPdUFVJy8UjT7w3pLs4NIkAAAAAABYAFER3cDt3SoCRjwyf8C554neRfEEIAAAAAAABAOABAAAAAAEBA25yul//7KOHqPxPx6asykloSE4QFT9vCz2LufmFDvoAAAAAAP////8CxD9tKQEAAAAWABQ0mFGsB1BNf+DQgaelclMt9IwQ/ICWmAAAAAAAF6kUj7XT5qHYxTP3HoD+GLrbSQT173GHAkgwRQIhAMU6BWUgRNGMtzI0jYH6qyu/IzS/z3Ddyyh+S799A67cAiBs9Lb5s3M7xqS2FD1cLsk49I58WHqYKVdbix6/mjDlLgEhAyY7QJUF5RHYBmORFIsMTmpxm3p8RSoPQ7/t8Ya4SCI1AAAAAAEBIICWmAAAAAAAF6kUj7XT5qHYxTP3HoD+GLrbSQT173GHAQMEAQAAAAEEFgAUW5GhmVAs5drxXTTjRL9npof3y04iBgLHc0MaMyTYA8ZcOkYq+ivpaD7QbmpluF0VhnAzYit3rxgAAAAAMQAAgAAAAIAAAACAAAAAAAAAAAAAAAA=

And the output from SignPsbt

cHNidP8BAHECAAAAAQFAmHjw8l/MwVoQLiDqP4cuNZCMixc3hl0RS7Bw/WteAQAAAAAAAAAAAkBCDwAAAAAAFgAUC5b32IzmloPdUFVJy8UjT7w3pLs4NIkAAAAAABYAFER3cDt3SoCRjwyf8C554neRfEEIAAAAAAABAOABAAAAAAEBA25yul//7KOHqPxPx6asykloSE4QFT9vCz2LufmFDvoAAAAAAP////8CxD9tKQEAAAAWABQ0mFGsB1BNf+DQgaelclMt9IwQ/ICWmAAAAAAAF6kUj7XT5qHYxTP3HoD+GLrbSQT173GHAkgwRQIhAMU6BWUgRNGMtzI0jYH6qyu/IzS/z3Ddyyh+S799A67cAiBs9Lb5s3M7xqS2FD1cLsk49I58WHqYKVdbix6/mjDlLgEhAyY7QJUF5RHYBmORFIsMTmpxm3p8RSoPQ7/t8Ya4SCI1AAAAAAEBIICWmAAAAAAAF6kUj7XT5qHYxTP3HoD+GLrbSQT173GHAQcXFgAUW5GhmVAs5drxXTTjRL9npof3y04AAAA=
@guggero guggero added this to the v0.15.1 milestone Jun 7, 2022
@guggero guggero added wallet The wallet (lnwallet) which LND uses psbt labels Jun 7, 2022
guggero added a commit to guggero/lnd that referenced this issue Jun 30, 2022
Fixes lightningnetwork#6626.
If either of the two fields FinalScriptSig or FinalScriptWitness is set
on an input of a PSBT then that results in most of the fields of that
input not to be serialized in the packet anymore, since the input is
considered to be complete.
But because a signer isn't supposed to set any of the Final* fields,
this was wrong from the beginning. Only the finalizer will set those
fields.
Roasbeef pushed a commit to Roasbeef/lnd that referenced this issue Aug 13, 2022
Fixes lightningnetwork#6626.
If either of the two fields FinalScriptSig or FinalScriptWitness is set
on an input of a PSBT then that results in most of the fields of that
input not to be serialized in the packet anymore, since the input is
considered to be complete.
But because a signer isn't supposed to set any of the Final* fields,
this was wrong from the beginning. Only the finalizer will set those
fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
psbt wallet The wallet (lnwallet) which LND uses
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants