@@ -405,7 +405,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk> {
405
405
Descriptor :: Pkh ( ref pkh) => pkh. script_pubkey ( ) ,
406
406
Descriptor :: Wpkh ( ref wpkh) => wpkh. script_pubkey ( ) ,
407
407
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" ) ,
409
409
Descriptor :: Tr ( ref tr) => tr. script_pubkey ( ) ,
410
410
}
411
411
}
@@ -1010,12 +1010,12 @@ pub(crate) use write_descriptor;
1010
1010
mod tests {
1011
1011
use core:: convert:: TryFrom ;
1012
1012
1013
+ use bitcoin:: address:: script_pubkey:: { BuilderExt as _, ScriptExt as _} ;
1013
1014
use bitcoin:: blockdata:: opcodes:: all:: { OP_CLTV , OP_CSV } ;
1014
1015
use bitcoin:: blockdata:: script:: Instruction ;
1015
1016
use bitcoin:: blockdata:: { opcodes, script} ;
1016
1017
use bitcoin:: hashes:: hex:: FromHex ;
1017
- use bitcoin:: hashes:: Hash ;
1018
- use bitcoin:: script:: PushBytes ;
1018
+ use bitcoin:: script:: { PushBytes , ScriptExt as _, ScriptBufExt as _} ;
1019
1019
use bitcoin:: sighash:: EcdsaSighashType ;
1020
1020
use bitcoin:: { bip32, PublicKey , Sequence } ;
1021
1021
@@ -1305,7 +1305,7 @@ mod tests {
1305
1305
let ms = ms_str ! ( "c:pk_k({})" , pk) ;
1306
1306
1307
1307
let mut txin = bitcoin:: TxIn {
1308
- previous_output : bitcoin:: OutPoint :: default ( ) ,
1308
+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1309
1309
script_sig : bitcoin:: ScriptBuf :: new ( ) ,
1310
1310
sequence : Sequence :: from_height ( 100 ) ,
1311
1311
witness : Witness :: default ( ) ,
@@ -1316,7 +1316,7 @@ mod tests {
1316
1316
assert_eq ! (
1317
1317
txin,
1318
1318
bitcoin:: TxIn {
1319
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1319
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1320
1320
script_sig: script:: Builder :: new( )
1321
1321
. push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1322
1322
. into_script( ) ,
@@ -1331,10 +1331,10 @@ mod tests {
1331
1331
assert_eq ! (
1332
1332
txin,
1333
1333
bitcoin:: TxIn {
1334
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1334
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1335
1335
script_sig: script:: Builder :: new( )
1336
1336
. push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1337
- . push_key( & pk)
1337
+ . push_key( pk)
1338
1338
. into_script( ) ,
1339
1339
sequence: Sequence :: from_height( 100 ) ,
1340
1340
witness: Witness :: default ( ) ,
@@ -1347,7 +1347,7 @@ mod tests {
1347
1347
assert_eq ! (
1348
1348
txin,
1349
1349
bitcoin:: TxIn {
1350
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1350
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1351
1351
script_sig: bitcoin:: ScriptBuf :: new( ) ,
1352
1352
sequence: Sequence :: from_height( 100 ) ,
1353
1353
witness: Witness :: from_slice( & [ sigser. clone( ) , pk. to_bytes( ) ] ) ,
@@ -1368,7 +1368,7 @@ mod tests {
1368
1368
assert_eq ! (
1369
1369
txin,
1370
1370
bitcoin:: TxIn {
1371
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1371
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1372
1372
script_sig: script:: Builder :: new( )
1373
1373
. push_slice( <& PushBytes >:: try_from( redeem_script. as_bytes( ) ) . unwrap( ) )
1374
1374
. into_script( ) ,
@@ -1389,7 +1389,7 @@ mod tests {
1389
1389
assert_eq ! (
1390
1390
txin,
1391
1391
bitcoin:: TxIn {
1392
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1392
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1393
1393
script_sig: script:: Builder :: new( )
1394
1394
. push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1395
1395
. push_slice( <& PushBytes >:: try_from( ms. encode( ) . as_bytes( ) ) . unwrap( ) )
@@ -1407,7 +1407,7 @@ mod tests {
1407
1407
assert_eq ! (
1408
1408
txin,
1409
1409
bitcoin:: TxIn {
1410
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1410
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1411
1411
script_sig: bitcoin:: ScriptBuf :: new( ) ,
1412
1412
sequence: Sequence :: from_height( 100 ) ,
1413
1413
witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1420,9 +1420,9 @@ mod tests {
1420
1420
assert_eq ! (
1421
1421
txin,
1422
1422
bitcoin:: TxIn {
1423
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1423
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1424
1424
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( ) )
1426
1426
. into_script( ) ,
1427
1427
sequence: Sequence :: from_height( 100 ) ,
1428
1428
witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1431,7 +1431,7 @@ mod tests {
1431
1431
assert_eq ! (
1432
1432
shwsh. unsigned_script_sig( ) ,
1433
1433
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( ) )
1435
1435
. into_script( )
1436
1436
) ;
1437
1437
}
@@ -1549,7 +1549,7 @@ mod tests {
1549
1549
. unwrap ( ) ;
1550
1550
1551
1551
let mut txin = bitcoin:: TxIn {
1552
- previous_output : bitcoin:: OutPoint :: default ( ) ,
1552
+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1553
1553
script_sig : bitcoin:: ScriptBuf :: new ( ) ,
1554
1554
sequence : Sequence :: ZERO ,
1555
1555
witness : Witness :: default ( ) ,
0 commit comments