bitcoindevkit / bitcoindevkit/bdk-cli

Improve error message / accept descriptor key expressions in descriptor command

Aperta
#303 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Rust
Stelle
141
Fork
99
Merge medio
6g 14m
PR unite (30g)
1

Descrizione

**Describe the enhancement**

`bdk-cli key derive` returns a descriptor key expression (e.g. `[fingerprint/path]xpub.../*`), while `bdk-cli descriptor` expects a raw `xpub`/`xprv`. Passing the output of `key derive` directly to `descriptor` results in:

```text
BIP32 error: base58 encoding error
```

The error doesn't explain that the input is a descriptor key expression rather than a raw extended key.

It would be helpful if `descriptor` either:-

* detected descriptor key expressions and emitted a more descriptive error or
* accepted descriptor key expressions directly.
---
**Use case**

A natural workflow is:

```text
key restore

key derive

descriptor
```

Since `key derive` produces a key intended for descriptors, it's reasonable to expect its output to be consumable by `descriptor`.

Instead, users encounter a low-level Base58 parsing error without any indication that the command expects a different representation.

---

**Additional context**

Reproducer:

```bash
bdk-cli key derive --xprv "tprv..." --derivation_path "m/84h/1h/0h"
```

Output:

```text
[bd2eb472/84'/1'/0']tprv.../*
```

Then:

```bash
bdk-cli descriptor --type wpkh "[bd2eb472/84'/1'/0']tprv.../*"
```

produces:

```text
BIP32 error: base58 encoding error
```

The same descriptor key expression works correctly when wrapped in a descriptor and passed to:

```bash
bdk-cli wallet config --ext-descriptor "wpkh([bd2eb472/84'/1'/0']tprv.../*)"
```

which suggests the underlying parsing is already supported in that context.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Esegui prima il reproducer documentato di `key derive` e `descriptor`, quindi traccia i punti di ingresso `bdk-cli key derive`, `descriptor` e `wallet config` per confrontare come vengono analizzati i relativi input. Il lavoro è completato quando le espressioni delle chiavi del descriptor vengono accettate direttamente da `descriptor` oppure rifiutate con una spiegazione esplicita della rappresentazione prevista, e i test dei comandi coprono il comportamento scelto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
cli
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.