@@ -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,13 +1010,14 @@ 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
+ use bitcoin:: witness:: WitnessExt ;
1020
1021
use bitcoin:: { bip32, PublicKey , Sequence } ;
1021
1022
1022
1023
use super :: checksum:: desc_checksum;
@@ -1305,7 +1306,7 @@ mod tests {
1305
1306
let ms = ms_str ! ( "c:pk_k({})" , pk) ;
1306
1307
1307
1308
let mut txin = bitcoin:: TxIn {
1308
- previous_output : bitcoin:: OutPoint :: default ( ) ,
1309
+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1309
1310
script_sig : bitcoin:: ScriptBuf :: new ( ) ,
1310
1311
sequence : Sequence :: from_height ( 100 ) ,
1311
1312
witness : Witness :: default ( ) ,
@@ -1316,7 +1317,7 @@ mod tests {
1316
1317
assert_eq ! (
1317
1318
txin,
1318
1319
bitcoin:: TxIn {
1319
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1320
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1320
1321
script_sig: script:: Builder :: new( )
1321
1322
. push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1322
1323
. into_script( ) ,
@@ -1331,10 +1332,10 @@ mod tests {
1331
1332
assert_eq ! (
1332
1333
txin,
1333
1334
bitcoin:: TxIn {
1334
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1335
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1335
1336
script_sig: script:: Builder :: new( )
1336
1337
. push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1337
- . push_key( & pk)
1338
+ . push_key( pk)
1338
1339
. into_script( ) ,
1339
1340
sequence: Sequence :: from_height( 100 ) ,
1340
1341
witness: Witness :: default ( ) ,
@@ -1347,7 +1348,7 @@ mod tests {
1347
1348
assert_eq ! (
1348
1349
txin,
1349
1350
bitcoin:: TxIn {
1350
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1351
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1351
1352
script_sig: bitcoin:: ScriptBuf :: new( ) ,
1352
1353
sequence: Sequence :: from_height( 100 ) ,
1353
1354
witness: Witness :: from_slice( & [ sigser. clone( ) , pk. to_bytes( ) ] ) ,
@@ -1368,7 +1369,7 @@ mod tests {
1368
1369
assert_eq ! (
1369
1370
txin,
1370
1371
bitcoin:: TxIn {
1371
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1372
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1372
1373
script_sig: script:: Builder :: new( )
1373
1374
. push_slice( <& PushBytes >:: try_from( redeem_script. as_bytes( ) ) . unwrap( ) )
1374
1375
. into_script( ) ,
@@ -1389,7 +1390,7 @@ mod tests {
1389
1390
assert_eq ! (
1390
1391
txin,
1391
1392
bitcoin:: TxIn {
1392
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1393
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1393
1394
script_sig: script:: Builder :: new( )
1394
1395
. push_slice( <& PushBytes >:: try_from( sigser. as_slice( ) ) . unwrap( ) )
1395
1396
. push_slice( <& PushBytes >:: try_from( ms. encode( ) . as_bytes( ) ) . unwrap( ) )
@@ -1407,7 +1408,7 @@ mod tests {
1407
1408
assert_eq ! (
1408
1409
txin,
1409
1410
bitcoin:: TxIn {
1410
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1411
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1411
1412
script_sig: bitcoin:: ScriptBuf :: new( ) ,
1412
1413
sequence: Sequence :: from_height( 100 ) ,
1413
1414
witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1420,9 +1421,9 @@ mod tests {
1420
1421
assert_eq ! (
1421
1422
txin,
1422
1423
bitcoin:: TxIn {
1423
- previous_output: bitcoin:: OutPoint :: default ( ) ,
1424
+ previous_output: bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1424
1425
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( ) )
1426
1427
. into_script( ) ,
1427
1428
sequence: Sequence :: from_height( 100 ) ,
1428
1429
witness: Witness :: from_slice( & [ sigser. clone( ) , ms. encode( ) . into_bytes( ) ] ) ,
@@ -1431,7 +1432,7 @@ mod tests {
1431
1432
assert_eq ! (
1432
1433
shwsh. unsigned_script_sig( ) ,
1433
1434
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( ) )
1435
1436
. into_script( )
1436
1437
) ;
1437
1438
}
@@ -1549,7 +1550,7 @@ mod tests {
1549
1550
. unwrap ( ) ;
1550
1551
1551
1552
let mut txin = bitcoin:: TxIn {
1552
- previous_output : bitcoin:: OutPoint :: default ( ) ,
1553
+ previous_output : bitcoin:: OutPoint :: COINBASE_PREVOUT ,
1553
1554
script_sig : bitcoin:: ScriptBuf :: new ( ) ,
1554
1555
sequence : Sequence :: ZERO ,
1555
1556
witness : Witness :: default ( ) ,
0 commit comments