cryptoadvance / cryptoadvance/specter-diy
Refactor Wallet.get_derivation() to accept a single PSBT scope
- Dominant language
- Python
- Stars
- 585
- Forks
- 108
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 5
Description
## Context
The wallet API currently requires callers to pass two separate derivation maps:
```python
wallet.get_derivation(bip32_derivations, taproot_bip32_derivations)
```
This forces call sites to repeat fallback logic such as `getattr(scope, "taproot_bip32_derivations", {})`, and the codebase already has inconsistent handling of PSBT scopes.
## Proposal
Change `Wallet.get_derivation()` to accept one PSBT input/output scope and let the wallet extract both metadata types internally:
```python
wallet.get_derivation(scope)
```
The method should preserve the current lookup order and return behavior for both BIP32 and Taproot derivations.
## Scope
- Update Bitcoin and Liquid call sites.
- Keep the derivation result and precedence unchanged.
- Add or update regression coverage for standard and Taproot metadata.
- Avoid changing the conservative change-classification security invariant from PR #387.
This is a maintainability/API follow-up and is intentionally separate from the security fix in PR #387.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading Wallet.get_derivation and tracing its Bitcoin and Liquid call sites. Check the existing handling of standard and Taproot PSBT metadata, then run the regression coverage for both paths. Done means callers pass one scope, lookup precedence and results remain unchanged, and the conservative change-classification invariant is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cryptography
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100