Skip to content

Commit 4469366

Browse files
committed
andor stack elem count bug
1 parent 2e147da commit 4469366

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/miniscript/types/extra_props.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,21 +675,22 @@ impl Property for ExtData {
675675
.and_then(|z| a.ops_count_nsat.map(|x| x + b.ops_count_static + z + 3)),
676676
stack_elem_count_sat: cmp::max(
677677
a.stack_elem_count_sat
678-
.and_then(|a| c.stack_elem_count_sat.map(|c| c + a)),
678+
.and_then(|a| b.stack_elem_count_sat.map(|b| b + a)),
679679
a.stack_elem_count_dissat
680-
.and_then(|a_dis| b.stack_elem_count_sat.map(|b| b + a_dis)),
680+
.and_then(|a_dis| c.stack_elem_count_sat.map(|c| c + a_dis)),
681681
),
682682
stack_elem_count_dissat: cmp::max(
683+
// non-cannonical
683684
a.stack_elem_count_sat
684-
.and_then(|a| c.stack_elem_count_dissat.map(|c| c + a)),
685+
.and_then(|a| b.stack_elem_count_dissat.map(|b| b + a)),
685686
a.stack_elem_count_dissat
686-
.and_then(|a_dis| b.stack_elem_count_dissat.map(|b| b + a_dis)),
687+
.and_then(|a_dis| c.stack_elem_count_dissat.map(|c| c + a_dis)),
687688
),
688689
max_sat_size: cmp::max(
689690
a.max_sat_size
690-
.and_then(|(wa, sa)| c.max_sat_size.map(|(wc, sc)| (wa + wc, sa + sc))),
691-
a.max_dissat_size
692691
.and_then(|(wa, sa)| b.max_sat_size.map(|(wb, sb)| (wa + wb, sa + sb))),
692+
a.max_dissat_size
693+
.and_then(|(wa, sa)| c.max_sat_size.map(|(wc, sc)| (wa + wc, sa + sc))),
693694
),
694695
max_dissat_size: a
695696
.max_dissat_size

0 commit comments

Comments
 (0)