File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -401,8 +401,8 @@ where
401401 hash160:: Hash :: from_hex ( x) . map ( Policy :: Hash160 )
402402 } ) ,
403403 ( "and" , _) => {
404- if top. args . is_empty ( ) {
405- return Err ( errstr ( "and without args " ) ) ;
404+ if top. args . len ( ) != 2 {
405+ return Err ( errstr ( "and fragment must have exactly two children " ) ) ;
406406 }
407407 let mut subs = Vec :: with_capacity ( top. args . len ( ) ) ;
408408 for arg in & top. args {
@@ -411,8 +411,8 @@ where
411411 Ok ( Policy :: And ( subs) )
412412 }
413413 ( "or" , _) => {
414- if top. args . is_empty ( ) {
415- return Err ( errstr ( "or without args " ) ) ;
414+ if top. args . len ( ) != 2 {
415+ return Err ( errstr ( "or fragment must have exactly two children " ) ) ;
416416 }
417417 let mut subs = Vec :: with_capacity ( top. args . len ( ) ) ;
418418 for arg in & top. args {
Original file line number Diff line number Diff line change @@ -234,8 +234,8 @@ where
234234 hash160:: Hash :: from_hex ( x) . map ( Policy :: Hash160 )
235235 } ) ,
236236 ( "and" , _) => {
237- if top. args . is_empty ( ) {
238- return Err ( errstr ( "and without args " ) ) ;
237+ if top. args . len ( ) != 2 {
238+ return Err ( errstr ( "and fragment must have exactly two children " ) ) ;
239239 }
240240 let mut subs = Vec :: with_capacity ( top. args . len ( ) ) ;
241241 for arg in & top. args {
@@ -244,8 +244,8 @@ where
244244 Ok ( Policy :: And ( subs) )
245245 }
246246 ( "or" , _) => {
247- if top. args . is_empty ( ) {
248- return Err ( errstr ( "or without args " ) ) ;
247+ if top. args . len ( ) != 2 {
248+ return Err ( errstr ( "or fragment must have exactly two children " ) ) ;
249249 }
250250 let mut subs = Vec :: with_capacity ( top. args . len ( ) ) ;
251251 for arg in & top. args {
You can’t perform that action at this time.
0 commit comments