@@ -184,9 +184,8 @@ mod tests {
184184 }
185185 }
186186
187- crate :: test_psbt_fixtures!( test_parse_network_mainnet_only, network, {
188- test_parse_with_format( fixtures:: TxFormat :: Psbt , network) ;
189- test_parse_with_format( fixtures:: TxFormat :: PsbtLite , network) ;
187+ crate :: test_psbt_fixtures!( test_parse_network_mainnet_only, network, format, {
188+ test_parse_with_format( format, network) ;
190189 } ) ;
191190
192191 #[ test]
@@ -242,9 +241,8 @@ mod tests {
242241 }
243242 }
244243
245- crate :: test_psbt_fixtures!( test_round_trip_mainnet_only, network, {
246- test_round_trip_with_format( fixtures:: TxFormat :: Psbt , network) ;
247- test_round_trip_with_format( fixtures:: TxFormat :: PsbtLite , network) ;
244+ crate :: test_psbt_fixtures!( test_round_trip_mainnet_only, network, format, {
245+ test_round_trip_with_format( format, network) ;
248246 } ) ;
249247
250248 fn parse_derivation_path ( path : & str ) -> Result < ( u32 , u32 ) , String > {
@@ -281,26 +279,6 @@ mod tests {
281279 Ok ( ( chain, index) )
282280 }
283281
284- fn find_input_with_script_type (
285- fixture : & fixtures:: PsbtFixture ,
286- script_type : fixtures:: ScriptType ,
287- ) -> Result < ( usize , & fixtures:: PsbtInputFixture ) , String > {
288- let result = fixture
289- . psbt_inputs
290- . iter ( )
291- . enumerate ( )
292- . filter ( |( _, input) | script_type. matches_fixture ( input) )
293- . collect :: < Vec < _ > > ( ) ;
294- if result. len ( ) != 1 {
295- return Err ( format ! (
296- "Expected 1 input with script type {}, got {}" ,
297- script_type. as_str( ) ,
298- result. len( )
299- ) ) ;
300- }
301- Ok ( result[ 0 ] )
302- }
303-
304282 fn get_output_script_from_non_witness_utxo (
305283 input : & fixtures:: P2shInput ,
306284 index : usize ,
@@ -343,7 +321,7 @@ mod tests {
343321
344322 // Check if the script type is supported by the network
345323 let output_script_support = network. output_script_support ( ) ;
346- let input_fixture = find_input_with_script_type ( & fixture , script_type) ;
324+ let input_fixture = fixture . find_input_with_script_type ( script_type) ;
347325 if !script_type. is_supported_by ( & output_script_support) {
348326 // Script type not supported by network - skip test (no fixture expected)
349327 assert ! (
@@ -441,101 +419,47 @@ mod tests {
441419 Ok ( ( ) )
442420 }
443421
444- crate :: test_psbt_fixtures!( test_p2sh_script_generation_from_fixture, network, {
445- test_wallet_script_type(
446- fixtures:: ScriptType :: P2sh ,
447- network,
448- fixtures:: TxFormat :: Psbt ,
449- )
450- . unwrap( ) ;
451- test_wallet_script_type(
452- fixtures:: ScriptType :: P2sh ,
453- network,
454- fixtures:: TxFormat :: PsbtLite ,
455- )
456- . unwrap( ) ;
422+ crate :: test_psbt_fixtures!( test_p2sh_script_generation_from_fixture, network, format, {
423+ test_wallet_script_type( fixtures:: ScriptType :: P2sh , network, format) . unwrap( ) ;
457424 } ) ;
458425
459- crate :: test_psbt_fixtures!( test_p2sh_p2wsh_script_generation_from_fixture, network, {
460- test_wallet_script_type(
461- fixtures:: ScriptType :: P2shP2wsh ,
462- network,
463- fixtures:: TxFormat :: Psbt ,
464- )
465- . unwrap( ) ;
466- test_wallet_script_type(
467- fixtures:: ScriptType :: P2shP2wsh ,
468- network,
469- fixtures:: TxFormat :: PsbtLite ,
470- )
471- . unwrap( ) ;
472- } ) ;
426+ crate :: test_psbt_fixtures!(
427+ test_p2sh_p2wsh_script_generation_from_fixture,
428+ network,
429+ format,
430+ {
431+ test_wallet_script_type( fixtures:: ScriptType :: P2shP2wsh , network, format) . unwrap( ) ;
432+ }
433+ ) ;
473434
474- crate :: test_psbt_fixtures!( test_p2wsh_script_generation_from_fixture, network, {
475- test_wallet_script_type(
476- fixtures:: ScriptType :: P2wsh ,
477- network,
478- fixtures:: TxFormat :: Psbt ,
479- )
480- . unwrap( ) ;
481- test_wallet_script_type(
482- fixtures:: ScriptType :: P2wsh ,
483- network,
484- fixtures:: TxFormat :: PsbtLite ,
485- )
486- . unwrap( ) ;
487- } ) ;
435+ crate :: test_psbt_fixtures!(
436+ test_p2wsh_script_generation_from_fixture,
437+ network,
438+ format,
439+ {
440+ test_wallet_script_type( fixtures:: ScriptType :: P2wsh , network, format) . unwrap( ) ;
441+ }
442+ ) ;
488443
489- crate :: test_psbt_fixtures!( test_p2tr_script_generation_from_fixture, network, {
490- test_wallet_script_type(
491- fixtures:: ScriptType :: P2tr ,
492- network,
493- fixtures:: TxFormat :: Psbt ,
494- )
495- . unwrap( ) ;
496- test_wallet_script_type(
497- fixtures:: ScriptType :: P2tr ,
498- network,
499- fixtures:: TxFormat :: PsbtLite ,
500- )
501- . unwrap( ) ;
444+ crate :: test_psbt_fixtures!( test_p2tr_script_generation_from_fixture, network, format, {
445+ test_wallet_script_type( fixtures:: ScriptType :: P2tr , network, format) . unwrap( ) ;
502446 } ) ;
503447
504448 crate :: test_psbt_fixtures!(
505449 test_p2tr_musig2_script_path_generation_from_fixture,
506450 network,
451+ format,
507452 {
508- test_wallet_script_type(
509- fixtures:: ScriptType :: P2trMusig2 ,
510- network,
511- fixtures:: TxFormat :: Psbt ,
512- )
513- . unwrap( ) ;
514- test_wallet_script_type(
515- fixtures:: ScriptType :: P2trMusig2 ,
516- network,
517- fixtures:: TxFormat :: PsbtLite ,
518- )
519- . unwrap( ) ;
453+ test_wallet_script_type( fixtures:: ScriptType :: P2trMusig2 , network, format) . unwrap( ) ;
520454 }
521455 ) ;
522456
523457 crate :: test_psbt_fixtures!(
524458 test_p2tr_musig2_key_path_spend_script_generation_from_fixture,
525459 network,
460+ format,
526461 {
527- test_wallet_script_type(
528- fixtures:: ScriptType :: TaprootKeypath ,
529- network,
530- fixtures:: TxFormat :: Psbt ,
531- )
532- . unwrap( ) ;
533- test_wallet_script_type(
534- fixtures:: ScriptType :: TaprootKeypath ,
535- network,
536- fixtures:: TxFormat :: PsbtLite ,
537- )
538- . unwrap( ) ;
462+ test_wallet_script_type( fixtures:: ScriptType :: TaprootKeypath , network, format) . unwrap( ) ;
539463 }
540464 ) ;
541465
0 commit comments