Skip to content

Commit

Permalink
descriptor: add unit test demonstrating sanity-checking behavior in <…
Browse files Browse the repository at this point in the history
…= 12.x

See rust-bitcoin#734 for
discussion of this. Meanwhile, add a unit test so we can determine when
the behavior changes.
  • Loading branch information
apoelstra committed Sep 1, 2024
1 parent 1a3605d commit 00cac40
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/descriptor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,22 @@ pk(03f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8))";
Descriptor::<DescriptorPublicKey>::from_str("wsh(andor(pk(tpubDEN9WSToTyy9ZQfaYqSKfmVqmq1VVLNtYfj3Vkqh67et57eJ5sTKZQBkHqSwPUsoSskJeaYnPttHe2VrkCsKA27kUaN9SDc5zhqeLzKa1rr/0'/<0;1;2;3>/*),older(10000),pk(tpubD8LYfn6njiA2inCoxwM7EuN3cuLVcaHAwLYeups13dpevd3nHLRdK9NdQksWXrhLQVxcUZRpnp5CkJ1FhE61WRAsHxDNAkvGkoQkAeWDYjV/8/<0;1;2>/*)))").unwrap_err();
}

#[test]
fn regression_734() {
Descriptor::<DescriptorPublicKey>::from_str(
"wsh(or_i(pk(0202baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0a66a),1))",
)
.unwrap();
Descriptor::<DescriptorPublicKey>::from_str(
"sh(or_i(pk(0202baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0a66a),1))",
)
.unwrap();
Descriptor::<DescriptorPublicKey>::from_str(
"tr(02baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0a66a,1)",
)
.unwrap_err();
}

#[test]
fn test_context_pks() {
let comp_key = bitcoin::PublicKey::from_str(
Expand Down

0 comments on commit 00cac40

Please sign in to comment.