Skip to content

Commit 0203377

Browse files
committed
Update multi_a to not include n wrapper
While we are at it, do not use the default impl. This makes these types of error easy to make. I think this could have easily been prevently if I was forced to explicitly write AnyNonZero in front of multi_a
1 parent 3da37c8 commit 0203377

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/miniscript/types/correctness.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ impl Property for Correctness {
159159
}
160160
}
161161

162+
fn from_multi_a(_: usize, _: usize) -> Self {
163+
Correctness {
164+
base: Base::B,
165+
input: Input::Any,
166+
dissatisfiable: true,
167+
unit: true,
168+
}
169+
}
170+
162171
fn from_hash() -> Self {
163172
Correctness {
164173
base: Base::B,

src/miniscript/types/malleability.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ impl Property for Malleability {
108108
}
109109
}
110110

111+
fn from_multi_a(_: usize, _: usize) -> Self {
112+
Malleability {
113+
dissat: Dissat::Unique,
114+
safe: true,
115+
non_malleable: true,
116+
}
117+
}
118+
111119
fn from_hash() -> Self {
112120
Malleability {
113121
dissat: Dissat::Unknown,

src/miniscript/types/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,7 @@ pub trait Property: Sized {
256256
fn from_multi(k: usize, n: usize) -> Self;
257257

258258
/// Type property of a `MultiA` fragment
259-
fn from_multi_a(k: usize, n: usize) -> Self {
260-
// default impl same as multi
261-
Self::from_multi(k, n)
262-
}
259+
fn from_multi_a(k: usize, n: usize) -> Self;
263260

264261
/// Type property of a hash fragment
265262
fn from_hash() -> Self;
@@ -572,6 +569,13 @@ impl Property for Type {
572569
}
573570
}
574571

572+
fn from_multi_a(k: usize, n: usize) -> Self {
573+
Type {
574+
corr: Property::from_multi_a(k, n),
575+
mall: Property::from_multi_a(k, n),
576+
}
577+
}
578+
575579
fn from_hash() -> Self {
576580
Type {
577581
corr: Property::from_hash(),

0 commit comments

Comments
 (0)