Skip to content

Convert bip32_derivation fields to bitcoin::PublicKey#77

Open
mpbagot wants to merge 1 commit intorust-bitcoin:masterfrom
mpbagot:feature/bip32-derivation-pubkey
Open

Convert bip32_derivation fields to bitcoin::PublicKey#77
mpbagot wants to merge 1 commit intorust-bitcoin:masterfrom
mpbagot:feature/bip32-derivation-pubkey

Conversation

@mpbagot
Copy link

@mpbagot mpbagot commented Mar 12, 2026

The bip32_derivation fields on Input and Output currently take BTreeMaps from secp256k1::PublicKey to KeySource. Most locations where these maps are constructed convert from the bitcoin type to the secp type. Further, the secp type can be trivially converted to the PublicKey type unambiguously in other places.

This change also prevents PSBTs from silently reserialising uncompressed keys in a compressed form, eliminating a footgun.

Convert bip32_derivation fields on Input and Output to take bitcoin PublicKey instead of secp256k1, and change all relevant uses.

Closes #76

The bip32_derivation fields on Input and Output currently take
BTreeMaps from secp256k1::PublicKey to KeySource. Most locations where
this map is constructed converts from the bitcoin type to the secp
type. Further, the secp type can be trivially converted to the
PublicKey type unambiguously in other places.

This change also prevents PSBTs from silently reserialising
uncompressed keys in a compressed form, eliminating a footgun.

Convert bip32_derivation fields on Input and Output to take bitcoin
PublicKey instead of secp256k1, and change all relevant uses.
Copy link
Collaborator

@nymius nymius left a comment

Choose a reason for hiding this comment

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

ACK 485a434

I have checked the referenced sources and the specification, and I agree with the conclusion of the linked discussion.

@nymius
Copy link
Collaborator

nymius commented Mar 12, 2026

I've checked the format, linter and others locally, but cargo-rmbt seems to be failing for changes in the interface.

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.

bip32_derivation fields in PSBT use secp256k1::PublicKey

2 participants