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

psbt: add support for new Taproot fields #1847

Merged
merged 7 commits into from
May 10, 2022

Conversation

guggero
Copy link
Collaborator

@guggero guggero commented Apr 23, 2022

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
Copy link

coveralls commented Apr 23, 2022

Pull Request Test Coverage Report for Build 2258483739

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

  • 318 of 499 (63.73%) changed or added relevant lines in 6 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.05%) to 55.056%

Changes Missing Coverage Covered Lines Changed/Added Lines %
btcutil/psbt/utils.go 4 17 23.53%
btcutil/psbt/taproot.go 77 95 81.05%
btcutil/psbt/partial_output.go 51 71 71.83%
btcutil/psbt/partial_input.go 139 192 72.4%
btcutil/psbt/finalizer.go 14 91 15.38%
Files with Coverage Reduction New Missed Lines %
connmgr/connmanager.go 2 86.07%
txscript/taproot.go 2 95.93%
Totals Coverage Status
Change from base Build 2242543066: 0.05%
Covered Lines: 26434
Relevant Lines: 48013

💛 - Coveralls

Copy link
Member

@Roasbeef Roasbeef left a comment

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.

btcutil/psbt/taproot.go Show resolved Hide resolved
btcutil/psbt/taproot.go Outdated Show resolved Hide resolved
btcutil/psbt/taproot.go Outdated Show resolved Hide resolved
btcutil/psbt/partial_input.go Show resolved Hide resolved
}
}

sort.Sort(TaprootScriptSpendSigSorter(pi.TaprootScriptSpendSig))
Copy link
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
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
Copy link
Collaborator Author

guggero commented May 2, 2022

Rebased and addressed all comments.

@guggero
Copy link
Collaborator Author

guggero commented May 2, 2022

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

@Roasbeef
Copy link
Member

Roasbeef commented May 3, 2022

Kicked things to re-run CI...

Copy link
Member

@Roasbeef Roasbeef left a comment

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
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