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

Verify psbt input data before finalizing #852

Merged
merged 2 commits into from
Mar 24, 2023

Conversation

ziggie1984
Copy link
Contributor

@ziggie1984 ziggie1984 commented Mar 20, 2023

This relates to lightningnetwork/lnd#7527 and btcsuite/btcd#1964.

This would be my solution where I would fix the problem in lnd, happy to here your thoughts.

Or should we maybe directly check this in the lnd project/package ?

wallet/psbt.go Outdated
@@ -389,6 +389,13 @@ func (w *Wallet) FinalizePsbt(keyScope *waddrmgr.KeyScope, account uint32,
return err
}

// Let't check that every input has either the nonwitness field or the
// witnessUtxo field populated.
err = psbt.VerifyInputs(packet)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we end up calling VerifyInputOutputLen in VerifyInputs (see other PR), we might as well replace the call above with this one.

// this call.
// wallet accounts (NP2WKH, P2WKH, P2TR), so any
// key scope provided doesn't impact the result
// of this call.

Choose a reason for hiding this comment

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

👍

@ziggie1984 ziggie1984 force-pushed the psbt-nil-pointer-bug branch from 515be82 to 4215cb9 Compare March 21, 2023 08:14
@ziggie1984 ziggie1984 marked this pull request as ready for review March 21, 2023 08:38
@guggero
Copy link
Collaborator

guggero commented Mar 22, 2023

I pushed a new tag v1.1.8 for the github.com/btcsuite/btcd/btcutil/psbt package.

@ziggie1984 ziggie1984 force-pushed the psbt-nil-pointer-bug branch from 4215cb9 to 01a2e9d Compare March 22, 2023 20:34
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix 🎉

@guggero guggero requested a review from positiveblue March 23, 2023 09:36
Copy link

@positiveblue positiveblue left a comment

Choose a reason for hiding this comment

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

2/3 🚀

@guggero guggero merged commit 520f650 into btcsuite:master Mar 24, 2023
buck54321 pushed a commit to buck54321/btcwallet that referenced this pull request Apr 21, 2024
buck54321 pushed a commit to buck54321/btcwallet that referenced this pull request Apr 21, 2024
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