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

btcutil/psbt: export helper functions, fix/add encoding of unknown fields #1942

Merged
merged 6 commits into from
Feb 2, 2023

Conversation

guggero
Copy link
Collaborator

@guggero guggero commented Jan 25, 2023

This PR fixes a bunch of small issues that allow the btcutil/psbt package to be used for adding custom fields (=[]*Unknown) to the transaction itself (global) as well as the outputs. We also export the BIP32 derivation info serialization/de-serialization related functions for easy re-use in other projects.

cc @ffranr.

@coveralls
Copy link

coveralls commented Jan 25, 2023

Pull Request Test Coverage Report for Build 4025400808

  • 115 of 137 (83.94%) changed or added relevant lines in 9 files are covered.
  • 16 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.05%) to 55.302%

Changes Missing Coverage Covered Lines Changed/Added Lines %
btcutil/psbt/utils.go 0 1 0.0%
btcutil/psbt/psbt.go 10 12 83.33%
btcutil/psbt/partial_input.go 51 60 85.0%
btcutil/psbt/partial_output.go 38 48 79.17%
Files with Coverage Reduction New Missed Lines %
btcutil/psbt/partial_output.go 2 69.02%
btcutil/psbt/psbt.go 2 72.58%
connmgr/connmanager.go 3 86.27%
btcutil/psbt/partial_input.go 4 76.7%
peer/peer.go 5 74.16%
Totals Coverage Status
Change from base Build 4002459649: 0.05%
Covered Lines: 26651
Relevant Lines: 48192

💛 - Coveralls

btcutil/psbt/partial_output.go Outdated Show resolved Hide resolved
btcutil/psbt/partial_output.go Show resolved Hide resolved
btcutil/psbt/partial_output.go Outdated Show resolved Hide resolved
btcutil/psbt/psbt.go Show resolved Hide resolved
To unify the way the unknown fields are handled, we change the global
ones to a slice of pointers as well. This makes it easier to add
generic handler code for unknown fields, if they are uniform across the
levels (global, input, output).
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
Copy link
Member

Roasbeef commented Feb 2, 2023

cc @sputn1ck

Copy link
Collaborator

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

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

LGTM

@guggero guggero merged commit ecf98ce into btcsuite:master Feb 2, 2023
@guggero guggero deleted the psbt-export branch February 2, 2023 10:47
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.

4 participants