@@ -26,10 +26,10 @@ use bitcoin::util::taproot::{
2626} ;
2727use bitcoin:: {
2828 schnorr as bip340, secp256k1, Amount , BlockHash , EcdsaSig ,
29- EcdsaSighashType , KeyPair , OutPoint , PubkeyHash , SchnorrSig ,
30- SchnorrSighashType , Script , ScriptHash , Sighash , Transaction , TxIn , TxOut ,
31- Txid , WPubkeyHash , WScriptHash , Witness , Wtxid , XOnlyPublicKey ,
32- XpubIdentifier ,
29+ EcdsaSighashType , KeyPair , LockTime , OutPoint , PackedLockTime , PubkeyHash ,
30+ SchnorrSig , SchnorrSighashType , Script , ScriptHash , Sequence , Sighash ,
31+ Transaction , TxIn , TxOut , Txid , WPubkeyHash , WScriptHash , Witness , Wtxid ,
32+ XOnlyPublicKey , XpubIdentifier ,
3333} ;
3434use bitcoin_hashes:: sha256;
3535
@@ -121,7 +121,7 @@ impl StrictEncode for TaprootMerkleBranch {
121121impl StrictDecode for TaprootMerkleBranch {
122122 fn strict_decode < D : Read > ( d : D ) -> Result < Self , Error > {
123123 let data = Vec :: < sha256:: Hash > :: strict_decode ( d) ?;
124- TaprootMerkleBranch :: from_inner ( data) . map_err ( |_| {
124+ TaprootMerkleBranch :: try_from ( data) . map_err ( |_| {
125125 Error :: DataIntegrityError ( s ! (
126126 "taproot merkle branch length exceeds 128 consensus limit"
127127 ) )
@@ -150,7 +150,7 @@ impl StrictDecode for secp256k1::SecretKey {
150150impl StrictEncode for bip340:: TweakedKeyPair {
151151 #[ inline]
152152 fn strict_encode < E : io:: Write > ( & self , e : E ) -> Result < usize , Error > {
153- self . into_inner ( ) . strict_encode ( e)
153+ self . to_inner ( ) . strict_encode ( e)
154154 }
155155}
156156
@@ -332,9 +332,13 @@ impl StrictEncode for SchnorrSighashType {
332332impl StrictDecode for SchnorrSighashType {
333333 #[ inline]
334334 fn strict_decode < D : Read > ( d : D ) -> Result < Self , Error > {
335- SchnorrSighashType :: from_u8 ( u8:: strict_decode ( d) ?) . map_err ( |_| {
336- Error :: DataIntegrityError ( s ! ( "invalid BIP431 SighashType value" ) )
337- } )
335+ SchnorrSighashType :: from_consensus_u8 ( u8:: strict_decode ( d) ?) . map_err (
336+ |_| {
337+ Error :: DataIntegrityError (
338+ s ! ( "invalid BIP431 SighashType value" ) ,
339+ )
340+ } ,
341+ )
338342 }
339343}
340344
@@ -436,6 +440,15 @@ impl Strategy for OutPoint {
436440impl Strategy for Witness {
437441 type Strategy = strategies:: BitcoinConsensus ;
438442}
443+ impl Strategy for LockTime {
444+ type Strategy = strategies:: BitcoinConsensus ;
445+ }
446+ impl Strategy for PackedLockTime {
447+ type Strategy = strategies:: BitcoinConsensus ;
448+ }
449+ impl Strategy for Sequence {
450+ type Strategy = strategies:: BitcoinConsensus ;
451+ }
439452impl Strategy for TxOut {
440453 type Strategy = strategies:: BitcoinConsensus ;
441454}
@@ -456,7 +469,7 @@ impl StrictEncode for address::Payload {
456469 33u8 . strict_encode ( & mut e) ? + sh. strict_encode ( & mut e) ?
457470 }
458471 address:: Payload :: WitnessProgram { version, program } => {
459- version. into_num ( ) . strict_encode ( & mut e) ?
472+ version. to_num ( ) . strict_encode ( & mut e) ?
460473 + program. strict_encode ( & mut e) ?
461474 }
462475 } )
@@ -473,7 +486,7 @@ impl StrictDecode for address::Payload {
473486 address:: Payload :: ScriptHash ( ScriptHash :: strict_decode ( & mut d) ?)
474487 }
475488 version if version <= 16 => address:: Payload :: WitnessProgram {
476- version : WitnessVersion :: from_num ( version)
489+ version : WitnessVersion :: try_from ( version)
477490 . expect ( "bech32::u8 decider is broken" ) ,
478491 program : StrictDecode :: strict_decode ( & mut d) ?,
479492 } ,
@@ -502,7 +515,7 @@ impl StrictDecode for Address {
502515
503516impl StrictEncode for Amount {
504517 fn strict_encode < E : io:: Write > ( & self , e : E ) -> Result < usize , Error > {
505- self . as_sat ( ) . strict_encode ( e)
518+ self . to_sat ( ) . strict_encode ( e)
506519 }
507520}
508521
@@ -749,7 +762,7 @@ impl StrictDecode for TapTree {
749762 builder. add_leaf ( depth, script)
750763 } )
751764 . map_err ( |err| Error :: DataIntegrityError ( err. to_string ( ) ) ) ?;
752- TapTree :: from_builder ( builder)
765+ TapTree :: try_from ( builder)
753766 . map_err ( |_| Error :: DataIntegrityError ( s ! ( "incomplete tree" ) ) )
754767 }
755768}
@@ -1023,7 +1036,7 @@ pub(crate) mod test {
10231036 secp256k1:: KeyPair :: from_seckey_slice ( & secp, & KEY ) . unwrap ( ) ;
10241037
10251038 let pk_ecdsa = secp256k1:: PublicKey :: from_secret_key ( & secp, & sk_ecdsa) ;
1026- let pk_schnorr = XOnlyPublicKey :: from_keypair ( & sk_schnorr) ;
1039+ let ( pk_schnorr, _parity ) = XOnlyPublicKey :: from_keypair ( & sk_schnorr) ;
10271040 let msg = Message :: from_slice ( & [ 1u8 ; 32 ] ) . unwrap ( ) ;
10281041
10291042 let ecdsa = secp. sign_ecdsa ( & msg, & sk_ecdsa) ;
0 commit comments