Skip to content

fix(keys): return secret bytes for single descriptor keys#1027

Draft
reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:keys
Draft

fix(keys): return secret bytes for single descriptor keys#1027
reez wants to merge 1 commit into
bitcoindevkit:masterfrom
reez:keys

Conversation

@reez

@reez reez commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Description

DescriptorSecretKey::from_string() accepts both extended private keys and single private keys encoded as WIF.

secret_bytes() only handled the extended private key case and treated single keys as unreachable, which caused a panic when called with a valid WIF-derived DescriptorSecretKey.

This updates secret_bytes() to return bytes for single private keys directly, while preserving existing behavior for extended private keys. It also handles multipath extended private keys by returning the underlying xprv secret bytes.

Documentation

Changelog

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing
  • I've added exactly one changelog:* label
  • I've linked the relevant upstream docs or specs above

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant