@@ -468,7 +468,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk> {
468468            Descriptor :: Pkh ( ref  pkh)  => pkh. script_pubkey ( ) , 
469469            Descriptor :: Wpkh ( ref  wpkh)  => wpkh. script_pubkey ( ) , 
470470            Descriptor :: Wsh ( ref  wsh)  => wsh. script_pubkey ( ) , 
471-             Descriptor :: Sh ( ref  sh)  => sh. script_pubkey ( ) , 
471+             Descriptor :: Sh ( ref  sh)  => sh. script_pubkey ( ) . expect ( "TODO: Handle error" ) , 
472472            Descriptor :: Tr ( ref  tr)  => tr. script_pubkey ( ) , 
473473        } 
474474    } 
@@ -1109,13 +1109,15 @@ pub(crate) use write_descriptor;
11091109mod  tests { 
11101110    use  core:: convert:: TryFrom ; 
11111111
1112+     use  bitcoin:: address:: script_pubkey:: { BuilderExt  as  _,  ScriptExt  as  _} ; 
11121113    use  bitcoin:: blockdata:: opcodes:: all:: { OP_CLTV ,  OP_CSV } ; 
11131114    use  bitcoin:: blockdata:: script:: Instruction ; 
11141115    use  bitcoin:: blockdata:: { opcodes,  script} ; 
1115-     use  bitcoin:: hashes:: Hash ; 
1116-     use  bitcoin:: script:: PushBytes ; 
1116+     use  bitcoin:: hashes:: hex :: FromHex ; 
1117+     use  bitcoin:: script:: { PushBytes ,   ScriptBufExt   as  _ ,   ScriptExt   as  _ } ; 
11171118    use  bitcoin:: sighash:: EcdsaSighashType ; 
1118-     use  bitcoin:: { bip32,  PublicKey ,  Sequence ,  XOnlyPublicKey } ; 
1119+     use  bitcoin:: witness:: WitnessExt ; 
1120+     use  bitcoin:: { bip32,  PublicKey ,  Sequence } ; 
11191121
11201122    use  super :: { checksum,  * } ; 
11211123    use  crate :: hex_script; 
@@ -1402,7 +1404,7 @@ mod tests {
14021404        let  ms = ms_str ! ( "c:pk_k({})" ,  pk) ; 
14031405
14041406        let  mut  txin = bitcoin:: TxIn  { 
1405-             previous_output :  bitcoin:: OutPoint :: default ( ) , 
1407+             previous_output :  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
14061408            script_sig :  bitcoin:: ScriptBuf :: new ( ) , 
14071409            sequence :  Sequence :: from_height ( 100 ) , 
14081410            witness :  Witness :: default ( ) , 
@@ -1413,7 +1415,7 @@ mod tests {
14131415        assert_eq ! ( 
14141416            txin, 
14151417            bitcoin:: TxIn  { 
1416-                 previous_output:  bitcoin:: OutPoint :: default ( ) , 
1418+                 previous_output:  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
14171419                script_sig:  script:: Builder :: new( ) 
14181420                    . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) ) 
14191421                    . into_script( ) , 
@@ -1428,10 +1430,10 @@ mod tests {
14281430        assert_eq ! ( 
14291431            txin, 
14301432            bitcoin:: TxIn  { 
1431-                 previous_output:  bitcoin:: OutPoint :: default ( ) , 
1433+                 previous_output:  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
14321434                script_sig:  script:: Builder :: new( ) 
14331435                    . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) ) 
1434-                     . push_key( & pk) 
1436+                     . push_key( pk) 
14351437                    . into_script( ) , 
14361438                sequence:  Sequence :: from_height( 100 ) , 
14371439                witness:  Witness :: default ( ) , 
@@ -1444,7 +1446,7 @@ mod tests {
14441446        assert_eq ! ( 
14451447            txin, 
14461448            bitcoin:: TxIn  { 
1447-                 previous_output:  bitcoin:: OutPoint :: default ( ) , 
1449+                 previous_output:  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
14481450                script_sig:  bitcoin:: ScriptBuf :: new( ) , 
14491451                sequence:  Sequence :: from_height( 100 ) , 
14501452                witness:  Witness :: from_slice( & [ sigser. clone( ) ,  pk. to_bytes( ) ] ) , 
@@ -1465,7 +1467,7 @@ mod tests {
14651467        assert_eq ! ( 
14661468            txin, 
14671469            bitcoin:: TxIn  { 
1468-                 previous_output:  bitcoin:: OutPoint :: default ( ) , 
1470+                 previous_output:  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
14691471                script_sig:  script:: Builder :: new( ) 
14701472                    . push_slice( <& PushBytes >:: try_from( redeem_script. as_bytes( ) ) . unwrap( ) ) 
14711473                    . into_script( ) , 
@@ -1486,7 +1488,7 @@ mod tests {
14861488        assert_eq ! ( 
14871489            txin, 
14881490            bitcoin:: TxIn  { 
1489-                 previous_output:  bitcoin:: OutPoint :: default ( ) , 
1491+                 previous_output:  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
14901492                script_sig:  script:: Builder :: new( ) 
14911493                    . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) ) 
14921494                    . push_slice( <& PushBytes >:: try_from( ms. encode( ) . as_bytes( ) ) . unwrap( ) ) 
@@ -1504,7 +1506,7 @@ mod tests {
15041506        assert_eq ! ( 
15051507            txin, 
15061508            bitcoin:: TxIn  { 
1507-                 previous_output:  bitcoin:: OutPoint :: default ( ) , 
1509+                 previous_output:  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
15081510                script_sig:  bitcoin:: ScriptBuf :: new( ) , 
15091511                sequence:  Sequence :: from_height( 100 ) , 
15101512                witness:  Witness :: from_slice( & [ sigser. clone( ) ,  ms. encode( ) . into_bytes( ) ] ) , 
@@ -1517,9 +1519,17 @@ mod tests {
15171519        assert_eq ! ( 
15181520            txin, 
15191521            bitcoin:: TxIn  { 
1520-                 previous_output:  bitcoin:: OutPoint :: default ( ) , 
1522+                 previous_output:  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
15211523                script_sig:  script:: Builder :: new( ) 
1522-                     . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . as_bytes( ) ) . unwrap( ) ) 
1524+                     . push_slice( 
1525+                         <& PushBytes >:: try_from( 
1526+                             ms. encode( ) 
1527+                                 . to_p2wsh( ) 
1528+                                 . expect( "TODO: Handle error" ) 
1529+                                 . as_bytes( ) 
1530+                         ) 
1531+                         . unwrap( ) 
1532+                     ) 
15231533                    . into_script( ) , 
15241534                sequence:  Sequence :: from_height( 100 ) , 
15251535                witness:  Witness :: from_slice( & [ sigser. clone( ) ,  ms. encode( ) . into_bytes( ) ] ) , 
@@ -1528,7 +1538,15 @@ mod tests {
15281538        assert_eq ! ( 
15291539            shwsh. unsigned_script_sig( ) , 
15301540            script:: Builder :: new( ) 
1531-                 . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . as_bytes( ) ) . unwrap( ) ) 
1541+                 . push_slice( 
1542+                     <& PushBytes >:: try_from( 
1543+                         ms. encode( ) 
1544+                             . to_p2wsh( ) 
1545+                             . expect( "TODO: Handle error" ) 
1546+                             . as_bytes( ) 
1547+                     ) 
1548+                     . unwrap( ) 
1549+                 ) 
15321550                . into_script( ) 
15331551        ) ; 
15341552    } 
@@ -1664,7 +1682,7 @@ mod tests {
16641682        . unwrap ( ) ; 
16651683
16661684        let  mut  txin = bitcoin:: TxIn  { 
1667-             previous_output :  bitcoin:: OutPoint :: default ( ) , 
1685+             previous_output :  bitcoin:: OutPoint :: COINBASE_PREVOUT , 
16681686            script_sig :  bitcoin:: ScriptBuf :: new ( ) , 
16691687            sequence :  Sequence :: ZERO , 
16701688            witness :  Witness :: default ( ) , 
0 commit comments