descriptor: Use DescriptorError instead of Error when reasonable

Change the return type of the `descriptor!()` macro and `ToWalletDescriptor` to
avoid having to map errors.

Also introduce more checks to validate descriptors built using the macro.
This commit is contained in:
Alekos Filini
2021-01-11 13:12:01 +01:00
parent 8510b2b86e
commit bf04a2cf69
9 changed files with 190 additions and 106 deletions

View File

@@ -1145,11 +1145,12 @@ mod test {
let (prvkey0, _pubkey0, _fingerprint0) = setup_keys(TPRV0_STR);
let (_prvkey1, pubkey1, _fingerprint1) = setup_keys(TPRV1_STR);
let sequence = 50;
#[rustfmt::skip]
let desc = descriptor!(wsh(thresh(
2,
pk(prvkey0),
s: pk(pubkey1),
s: d: v: older(sequence)
s:pk(pubkey1),
s:d:v:older(sequence)
)))
.unwrap();