Skip to content

A bug for generating testnet descriptor? #22

@eauxxs

Description

@eauxxs

Describe the bug
I want a testnet descriptor key, but get a mainnet descriptor key.

To Reproduce

#[test]
fn test_override() {
    let xpriv: GeneratedKey<Xpriv, miniscript::Segwitv0> = Xpriv::generate(()).unwrap();
    let a =  xpriv.into_descriptor_key(None, "m/84h/1h/0h".parse().unwrap()).unwrap();
    let a = a.override_valid_networks(test_networks());
    let secp = SecpCtx::new();
    println!("{}", a.extract(&secp).unwrap().0);
    // [be3917e7/84'/1'/0']xpub6BxR3GaY9SrwFUWTRnmu3qyit4GECypBqNJPycFbFNGLkkh4Bjszb2LGqUbuF1ogEfCTvLo8V3DwPtuqcG4An2h34LQywRmUusRFErevX4L/*
}

Expected behavior
[fingerprint/derivepath]tpubxxxxx/*

Build environment

  • BDK tag/commit:
  • OS+version:
  • Rust/Cargo version:
  • Rust/Cargo target:

Additional context
https://github.com/bitcoindevkit/bdk/blob/9af0fd4d1d039b94caeecf290897006868dbe7f6/crates/wallet/src/keys/mod.rs#L716-L718

I don't know if this flow is correct, but reading it literally it should produce a testnet descriptor. So I'm not sure if this is a bug or not.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions