-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Description
When working on descriptor support for stratum I realized that I would like to check for testnet keys and (attempt to) refuse to use them on mainnet, on the basis that mainnet coins sent to testnet addresses may wind up blackholed.
This isn't too hard for me to implement by iterating through all my DescriptorPublicKey
s, looking at the xpubs (if they are xpubs) and looking at the network bytes.
But this raises a few questions:
- At parsing time should we insist that xkeys have consistent network bytes?
- Should we expose some sort of convenience method for obtaining these bytes?
I am thinking about adding an enum
enum XKeyNetwork {
/// No xkeys are present
NoXKeys,
/// xkeys are present but have conflicting network prefixes
Mixed,
/// xkey(s)s are present and all have the same network prefix
Single(bitcoin::Network),
}
and a helper method on Descriptor<DescriptorPublicKey>
and Descriptor<DefiniteDescriptorKey>
that returns this enum.
Metadata
Metadata
Assignees
Labels
No labels