File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1469,6 +1469,25 @@ mod tests {
14691469 } ;
14701470 }
14711471 }
1472+
1473+ #[ test]
1474+ fn segwit_limits ( ) {
1475+ // Hit the maximum witness stack elements limit
1476+ let ( keys, _) = pubkeys_and_a_sig ( 100 ) ;
1477+ let keys: Vec < Concrete < bitcoin:: PublicKey > > =
1478+ keys. iter ( ) . map ( |pubkey| Concrete :: Key ( * pubkey) ) . collect ( ) ;
1479+ let thresh_res: Result < SegwitMiniScript , _ > =
1480+ Concrete :: Threshold ( keys. len ( ) , keys) . compile ( ) ;
1481+ let n_elements = thresh_res
1482+ . clone ( )
1483+ . and_then ( |m| Ok ( m. max_satisfaction_witness_elements ( ) ) ) ;
1484+ assert_eq ! (
1485+ thresh_res,
1486+ Err ( CompilerError :: LimitsExceeded ) ,
1487+ "Compilation succeeded with '{:?}' elements" ,
1488+ n_elements,
1489+ ) ;
1490+ }
14721491}
14731492
14741493#[ cfg( all( test, feature = "unstable" ) ) ]
You can’t perform that action at this time.
0 commit comments