Skip to content

get_descriptor_for_keychain(KeychainKind::Internal) should return None if there is no internal keychain #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
w0xlt opened this issue Jan 12, 2022 · 3 comments

Comments

@w0xlt
Copy link
Contributor

w0xlt commented Jan 12, 2022

The code below returns the external descriptor.

I understand that external descriptor will be used as (internal) change descriptor if it does not exist, but I think it would be better and less ambiguous if the function returned None or Error when explicitly calling the internal descriptor.

This would also make a better distinction between external and internal descriptors and be more in line with the wallet structure.

let wallet = Wallet::new_offline(
        "<desc>",
        None,
        network,
        MemoryDatabase::default(),
)
.unwrap();

let desc = wallet.get_descriptor_for_keychain(KeychainKind::Internal);

println!("desc: {}", desc.to_string());
@LLFourn
Copy link
Contributor

LLFourn commented Jan 13, 2022

Or maybe just has_descriptor_for_keychain returning a bool.

@w0xlt
Copy link
Contributor Author

w0xlt commented Jan 13, 2022

Good suggestion.
I opened #528 to add this function.

@LLFourn
Copy link
Contributor

LLFourn commented Feb 16, 2022

As mentioned in #528 you can do this with Wallet::public_descriptor and checking if the return value is is_none().

@LLFourn LLFourn closed this as completed Feb 16, 2022
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

No branches or pull requests

3 participants