@@ -405,7 +405,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk> {
405405 Descriptor :: Pkh ( ref pkh) => pkh. script_pubkey ( ) ,
406406 Descriptor :: Wpkh ( ref wpkh) => wpkh. script_pubkey ( ) ,
407407 Descriptor :: Wsh ( ref wsh) => wsh. script_pubkey ( ) ,
408- Descriptor :: Sh ( ref sh) => sh. script_pubkey ( ) ,
408+ Descriptor :: Sh ( ref sh) => sh. script_pubkey ( ) . expect ( "TODO: Handle error" ) ,
409409 Descriptor :: Tr ( ref tr) => tr. script_pubkey ( ) ,
410410 }
411411 }
@@ -1010,12 +1010,12 @@ pub(crate) use write_descriptor;
10101010mod tests {
10111011 use core:: convert:: TryFrom ;
10121012
1013+ use bitcoin:: address:: script_pubkey:: { BuilderExt as _, ScriptExt as _} ;
10131014 use bitcoin:: blockdata:: opcodes:: all:: { OP_CLTV , OP_CSV } ;
10141015 use bitcoin:: blockdata:: script:: Instruction ;
10151016 use bitcoin:: blockdata:: { opcodes, script} ;
10161017 use bitcoin:: hashes:: hex:: FromHex ;
1017- use bitcoin:: hashes:: Hash ;
1018- use bitcoin:: script:: PushBytes ;
1018+ use bitcoin:: script:: { PushBytes , ScriptExt as _, ScriptBufExt as _} ;
10191019 use bitcoin:: sighash:: EcdsaSighashType ;
10201020 use bitcoin:: { bip32, PublicKey , Sequence } ;
10211021
@@ -1305,7 +1305,7 @@ mod tests {
13051305 let ms = ms_str ! ( "c:pk_k({})" , pk) ;
13061306
13071307 let mut txin = bitcoin:: TxIn {
1308- previous_output : bitcoin:: OutPoint :: default ( ) ,
1308+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13091309 script_sig : bitcoin:: ScriptBuf :: new ( ) ,
13101310 sequence : Sequence :: from_height ( 100 ) ,
13111311 witness : Witness :: default ( ) ,
@@ -1316,7 +1316,7 @@ mod tests {
13161316 assert_eq ! (
13171317 txin,
13181318 bitcoin:: TxIn {
1319- previous_output: bitcoin:: OutPoint :: default ( ) ,
1319+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13201320 script_sig: script:: Builder :: new( )
13211321 . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
13221322 . into_script( ) ,
@@ -1331,10 +1331,10 @@ mod tests {
13311331 assert_eq ! (
13321332 txin,
13331333 bitcoin:: TxIn {
1334- previous_output: bitcoin:: OutPoint :: default ( ) ,
1334+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13351335 script_sig: script:: Builder :: new( )
13361336 . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1337- . push_key( & pk)
1337+ . push_key( pk)
13381338 . into_script( ) ,
13391339 sequence: Sequence :: from_height( 100 ) ,
13401340 witness: Witness :: default ( ) ,
@@ -1347,7 +1347,7 @@ mod tests {
13471347 assert_eq ! (
13481348 txin,
13491349 bitcoin:: TxIn {
1350- previous_output: bitcoin:: OutPoint :: default ( ) ,
1350+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13511351 script_sig: bitcoin:: ScriptBuf :: new( ) ,
13521352 sequence: Sequence :: from_height( 100 ) ,
13531353 witness: Witness :: from_slice( & [ sigser. clone( ) , pk. to_bytes( ) ] ) ,
@@ -1368,7 +1368,7 @@ mod tests {
13681368 assert_eq ! (
13691369 txin,
13701370 bitcoin:: TxIn {
1371- previous_output: bitcoin:: OutPoint :: default ( ) ,
1371+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13721372 script_sig: script:: Builder :: new( )
13731373 . push_slice( <& PushBytes >:: try_from( redeem_script. as_bytes( ) ) . unwrap( ) )
13741374 . into_script( ) ,
@@ -1389,7 +1389,7 @@ mod tests {
13891389 assert_eq ! (
13901390 txin,
13911391 bitcoin:: TxIn {
1392- previous_output: bitcoin:: OutPoint :: default ( ) ,
1392+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13931393 script_sig: script:: Builder :: new( )
13941394 . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
13951395 . push_slice( <& PushBytes >:: try_from( ms. encode( ) . as_bytes( ) ) . unwrap( ) )
@@ -1407,7 +1407,7 @@ mod tests {
14071407 assert_eq ! (
14081408 txin,
14091409 bitcoin:: TxIn {
1410- previous_output: bitcoin:: OutPoint :: default ( ) ,
1410+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
14111411 script_sig: bitcoin:: ScriptBuf :: new( ) ,
14121412 sequence: Sequence :: from_height( 100 ) ,
14131413 witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1420,9 +1420,9 @@ mod tests {
14201420 assert_eq ! (
14211421 txin,
14221422 bitcoin:: TxIn {
1423- previous_output: bitcoin:: OutPoint :: default ( ) ,
1423+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
14241424 script_sig: script:: Builder :: new( )
1425- . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . as_bytes( ) ) . unwrap( ) )
1425+ . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . expect ( "TODO: Handle error" ) . as_bytes( ) ) . unwrap( ) )
14261426 . into_script( ) ,
14271427 sequence: Sequence :: from_height( 100 ) ,
14281428 witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1431,7 +1431,7 @@ mod tests {
14311431 assert_eq ! (
14321432 shwsh. unsigned_script_sig( ) ,
14331433 script:: Builder :: new( )
1434- . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . as_bytes( ) ) . unwrap( ) )
1434+ . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . expect ( "TODO: Handle error" ) . as_bytes( ) ) . unwrap( ) )
14351435 . into_script( )
14361436 ) ;
14371437 }
@@ -1549,7 +1549,7 @@ mod tests {
15491549 . unwrap ( ) ;
15501550
15511551 let mut txin = bitcoin:: TxIn {
1552- previous_output : bitcoin:: OutPoint :: default ( ) ,
1552+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
15531553 script_sig : bitcoin:: ScriptBuf :: new ( ) ,
15541554 sequence : Sequence :: ZERO ,
15551555 witness : Witness :: default ( ) ,
0 commit comments