Skip to content

Do unified descriptors covering x-only and other bitcoin key derivation #60

@dr-orlovsky

Description

@dr-orlovsky

To prevent situations like this:

/// Creates scriptPubkey for specific derive pattern in pre-taproot
/// descriptors
fn script_pubkey_pretr<C: Verification>(
&self,
secp: &Secp256k1<C>,
pat: impl AsRef<[UnhardenedIndex]>,
) -> Result<Script, DeriveError>;
/// Creates scriptPubkey for specific derive pattern in taproot descriptors
fn script_pubkey_tr<C: Verification>(
&self,
secp: &Secp256k1<C>,
pat: impl AsRef<[UnhardenedIndex]>,
) -> Result<Script, DeriveError>;

and like this, where a potential bugs may happen:

let scripts = indexes
.into_iter()
.map(|index| {
if let Some(i) = derivation.borrow_mut().last_mut() {
*i = index
}
Ok((
index,
descriptor.script_pubkey_pretr(secp, &*derivation.borrow())?,
))
})
.collect::<Result<BTreeMap<_, _>, DeriveError>>()?;

Metadata

Metadata

Assignees

Labels

epicEpic taskrefactoringRefactoring of the existing code

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions