Skip to content

psbt: add support for new Taproot fields - #1847

Merged
Roasbeef merged 7 commits into
btcsuite:masterfrom
guggero:taproot-psbt
May 10, 2022
Merged

Roasbeef merged 7 commits into
btcsuite:masterfrom
guggero:taproot-psbt

Conversation

@guggero

@guggero guggero commented Apr 23, 2022

Copy link
Copy Markdown
Collaborator

Adds new Taproot specific fields to PSBT as defined in https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki.

Test vectors taken from bitcoin/bitcoin#22558.

@coveralls

coveralls commented Apr 23, 2022 •

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 2239487179

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 306 of 490 (62.45%) changed or added relevant lines in 6 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.05%) to 54.319%

Changes Missing Coverage Covered Lines Changed/Added Lines %
btcutil/psbt/utils.go 4 17 23.53%
btcutil/psbt/taproot.go 73 92 79.35%
btcutil/psbt/partial_output.go 48 68 70.59%
btcutil/psbt/partial_input.go 134 189 70.9%
btcutil/psbt/finalizer.go 14 91 15.38%
Files with Coverage Reduction New Missed Lines %
btcutil/gcs/gcs.go 1 81.25%
btcutil/psbt/partial_input.go 2 76.35%
txscript/taproot.go 3 95.7%
Totals Coverage Status
Change from base Build 2186219467: 0.05%
Covered Lines: 25444
Relevant Lines: 46842

💛 - Coveralls

@Roasbeef Roasbeef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work! Cool to be on the on the bleeding edge when it comes to stuff like this 🤓. Will circle back re testing between hardwarewallets/bitcoind on that lnd PR.

Comment thread btcutil/psbt/taproot.go Resolved
Comment thread btcutil/psbt/taproot.go Resolved
Comment thread btcutil/psbt/taproot.go Resolved
Comment thread btcutil/psbt/partial_input.go Resolved
Comment thread btcutil/psbt/partial_input.go Outdated
}
}

sort.Sort(TaprootScriptSpendSigSorter(pi.TaprootScriptSpendSig))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where does the BIP actually mandate that these contents be sorted? Or is this just something we're adding to make testing easier since our serialization would be deterministic-ish?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The BIP doesn't mention it. I just followed the existing pattern of the library. But I guess it's nice to have things in a stable order? Though since we're not using maps internally but slices, the order should remain stable anyway...

@guggero

guggero commented May 2, 2022

Copy link
Copy Markdown
Collaborator Author

Rebased and addressed all comments.

@guggero
guggero requested a review from Roasbeef May 2, 2022 14:20
@guggero

guggero commented May 2, 2022

Copy link
Copy Markdown
Collaborator Author

Unit test failure seems to be a flake... Can't reproduce locally.

@Roasbeef

Roasbeef commented May 3, 2022

Copy link
Copy Markdown
Member

Kicked things to re-run CI...

@Roasbeef Roasbeef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 🎗

@Roasbeef
Roasbeef merged commit cc46b0f into btcsuite:master May 10, 2022
@guggero
guggero deleted the taproot-psbt branch May 11, 2022 07:18
asheswook pushed a commit to asheswook/btcd that referenced this pull request Apr 2, 2026
psbt: add support for new Taproot fields
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