From 00cac40ef68a0c74e40e9a252000f21dfb82c58a Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Sat, 31 Aug 2024 20:36:29 +0000 Subject: [PATCH] descriptor: add unit test demonstrating sanity-checking behavior in <= 12.x See https://github.com/rust-bitcoin/rust-miniscript/issues/734 for discussion of this. Meanwhile, add a unit test so we can determine when the behavior changes. --- src/descriptor/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/descriptor/mod.rs b/src/descriptor/mod.rs index 1a2a7da16..d9b3a9f51 100644 --- a/src/descriptor/mod.rs +++ b/src/descriptor/mod.rs @@ -2011,6 +2011,22 @@ pk(03f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8))"; Descriptor::::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::::from_str( + "wsh(or_i(pk(0202baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0a66a),1))", + ) + .unwrap(); + Descriptor::::from_str( + "sh(or_i(pk(0202baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0a66a),1))", + ) + .unwrap(); + Descriptor::::from_str( + "tr(02baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0a66a,1)", + ) + .unwrap_err(); + } + #[test] fn test_context_pks() { let comp_key = bitcoin::PublicKey::from_str(