@@ -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,13 +1010,14 @@ 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 ;
1020+ use bitcoin:: witness:: WitnessExt ;
10201021 use bitcoin:: { bip32, PublicKey , Sequence } ;
10211022
10221023 use super :: checksum:: desc_checksum;
@@ -1305,7 +1306,7 @@ mod tests {
13051306 let ms = ms_str ! ( "c:pk_k({})" , pk) ;
13061307
13071308 let mut txin = bitcoin:: TxIn {
1308- previous_output : bitcoin:: OutPoint :: default ( ) ,
1309+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13091310 script_sig : bitcoin:: ScriptBuf :: new ( ) ,
13101311 sequence : Sequence :: from_height ( 100 ) ,
13111312 witness : Witness :: default ( ) ,
@@ -1316,7 +1317,7 @@ mod tests {
13161317 assert_eq ! (
13171318 txin,
13181319 bitcoin:: TxIn {
1319- previous_output: bitcoin:: OutPoint :: default ( ) ,
1320+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13201321 script_sig: script:: Builder :: new( )
13211322 . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
13221323 . into_script( ) ,
@@ -1331,10 +1332,10 @@ mod tests {
13311332 assert_eq ! (
13321333 txin,
13331334 bitcoin:: TxIn {
1334- previous_output: bitcoin:: OutPoint :: default ( ) ,
1335+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13351336 script_sig: script:: Builder :: new( )
13361337 . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1337- . push_key( & pk)
1338+ . push_key( pk)
13381339 . into_script( ) ,
13391340 sequence: Sequence :: from_height( 100 ) ,
13401341 witness: Witness :: default ( ) ,
@@ -1347,7 +1348,7 @@ mod tests {
13471348 assert_eq ! (
13481349 txin,
13491350 bitcoin:: TxIn {
1350- previous_output: bitcoin:: OutPoint :: default ( ) ,
1351+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13511352 script_sig: bitcoin:: ScriptBuf :: new( ) ,
13521353 sequence: Sequence :: from_height( 100 ) ,
13531354 witness: Witness :: from_slice( & [ sigser. clone( ) , pk. to_bytes( ) ] ) ,
@@ -1368,7 +1369,7 @@ mod tests {
13681369 assert_eq ! (
13691370 txin,
13701371 bitcoin:: TxIn {
1371- previous_output: bitcoin:: OutPoint :: default ( ) ,
1372+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13721373 script_sig: script:: Builder :: new( )
13731374 . push_slice( <& PushBytes >:: try_from( redeem_script. as_bytes( ) ) . unwrap( ) )
13741375 . into_script( ) ,
@@ -1389,7 +1390,7 @@ mod tests {
13891390 assert_eq ! (
13901391 txin,
13911392 bitcoin:: TxIn {
1392- previous_output: bitcoin:: OutPoint :: default ( ) ,
1393+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
13931394 script_sig: script:: Builder :: new( )
13941395 . push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
13951396 . push_slice( <& PushBytes >:: try_from( ms. encode( ) . as_bytes( ) ) . unwrap( ) )
@@ -1407,7 +1408,7 @@ mod tests {
14071408 assert_eq ! (
14081409 txin,
14091410 bitcoin:: TxIn {
1410- previous_output: bitcoin:: OutPoint :: default ( ) ,
1411+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
14111412 script_sig: bitcoin:: ScriptBuf :: new( ) ,
14121413 sequence: Sequence :: from_height( 100 ) ,
14131414 witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1420,9 +1421,9 @@ mod tests {
14201421 assert_eq ! (
14211422 txin,
14221423 bitcoin:: TxIn {
1423- previous_output: bitcoin:: OutPoint :: default ( ) ,
1424+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
14241425 script_sig: script:: Builder :: new( )
1425- . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . as_bytes( ) ) . unwrap( ) )
1426+ . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . expect ( "TODO: Handle error" ) . as_bytes( ) ) . unwrap( ) )
14261427 . into_script( ) ,
14271428 sequence: Sequence :: from_height( 100 ) ,
14281429 witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1431,7 +1432,7 @@ mod tests {
14311432 assert_eq ! (
14321433 shwsh. unsigned_script_sig( ) ,
14331434 script:: Builder :: new( )
1434- . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . as_bytes( ) ) . unwrap( ) )
1435+ . push_slice( <& PushBytes >:: try_from( ms. encode( ) . to_p2wsh( ) . expect ( "TODO: Handle error" ) . as_bytes( ) ) . unwrap( ) )
14351436 . into_script( )
14361437 ) ;
14371438 }
@@ -1549,7 +1550,7 @@ mod tests {
15491550 . unwrap ( ) ;
15501551
15511552 let mut txin = bitcoin:: TxIn {
1552- previous_output : bitcoin:: OutPoint :: default ( ) ,
1553+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
15531554 script_sig : bitcoin:: ScriptBuf :: new ( ) ,
15541555 sequence : Sequence :: ZERO ,
15551556 witness : Witness :: default ( ) ,
0 commit comments