@@ -52,17 +52,17 @@ pub fn extract_pubkey(txin: TxIn, script_pubkey: &ScriptBuf) -> Option<(SpInputs
5252 use SpInputs :: * ;
5353
5454 tag_txin ( & txin, script_pubkey) . and_then ( |tag| match tag {
55- WrappedSegwit | P2WPKH => {
55+ ShWpkh | Wpkh => {
5656 let maybe_pk = txin. witness . last ( ) . expect ( "already checked is not empty" ) ;
5757 bitcoin:: PublicKey :: from_slice ( maybe_pk)
5858 . ok ( )
5959 . filter ( |pubkey| pubkey. compressed )
6060 . map ( |pk| ( tag, pk. inner ) )
6161 }
62- P2TR => XOnlyPublicKey :: from_slice ( & script_pubkey. as_bytes ( ) [ 2 ..34 ] )
62+ Tr => XOnlyPublicKey :: from_slice ( & script_pubkey. as_bytes ( ) [ 2 ..34 ] )
6363 . ok ( )
6464 . map ( |xonly_pk| ( tag, xonly_pk. public_key ( Parity :: Even ) ) ) ,
65- P2PKH => txin
65+ Pkh => txin
6666 . script_sig
6767 . into_bytes ( )
6868 . windows ( 33 )
@@ -300,7 +300,7 @@ mod tests {
300300
301301 let ( input_type, parsed_pubkey) = maybe_pubkey. expect ( "is some" ) ;
302302
303- assert_eq ! ( SpInputs :: WrappedSegwit , input_type) ;
303+ assert_eq ! ( SpInputs :: ShWpkh , input_type) ;
304304
305305 assert_eq ! ( expected_pubkey, parsed_pubkey) ;
306306 }
@@ -335,7 +335,7 @@ mod tests {
335335
336336 let ( input_type, parsed_pubkey) = maybe_pubkey. expect ( "is some" ) ;
337337
338- assert_eq ! ( SpInputs :: P2WPKH , input_type) ;
338+ assert_eq ! ( SpInputs :: Wpkh , input_type) ;
339339
340340 assert_eq ! ( expected_pubkey, parsed_pubkey) ;
341341 }
@@ -372,7 +372,7 @@ mod tests {
372372
373373 let ( input_type, parsed_pubkey) = maybe_pubkey. expect ( "is some" ) ;
374374
375- assert_eq ! ( SpInputs :: P2TR , input_type) ;
375+ assert_eq ! ( SpInputs :: Tr , input_type) ;
376376
377377 assert_eq ! ( expected_pubkey, parsed_pubkey) ;
378378 }
@@ -405,7 +405,7 @@ mod tests {
405405
406406 let ( input_type, parsed_pubkey) = maybe_pubkey. expect ( "is some" ) ;
407407
408- assert_eq ! ( SpInputs :: P2PKH , input_type) ;
408+ assert_eq ! ( SpInputs :: Pkh , input_type) ;
409409
410410 assert_eq ! ( expected_pubkey, parsed_pubkey) ;
411411 }
@@ -417,16 +417,16 @@ mod tests {
417417 . expect ( "should succeed" ) ;
418418 // only input from mainnet tx 4316fe7be359937317f42ffaf05ab02554297fb83096a0beb985a25f9e338215
419419 let txin = TxIn {
420- previous_output : OutPoint {
421- txid : "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16"
422- . parse ( )
423- . unwrap ( ) ,
424- vout : 1 ,
425- } ,
426- script_sig : ScriptBuf :: from_hex ( "0075473045022100a8c61b2d470e393279d1ba54f254b7c237de299580b7fa01ffcc940442ecec4502201afba952f4e4661c40acde7acc0341589031ba103a307b886eb867b23b850b972103782eeb913431ca6e9b8c2fd80a5f72ed2024ef72a3c6fb10263c379937323338" ) . expect ( "should succeed" ) ,
427- sequence : Sequence :: MAX ,
428- witness : Witness :: new ( ) ,
429- } ;
420+ previous_output : OutPoint {
421+ txid : "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16"
422+ . parse ( )
423+ . unwrap ( ) ,
424+ vout : 1 ,
425+ } ,
426+ script_sig : ScriptBuf :: from_hex ( "0075473045022100a8c61b2d470e393279d1ba54f254b7c237de299580b7fa01ffcc940442ecec4502201afba952f4e4661c40acde7acc0341589031ba103a307b886eb867b23b850b972103782eeb913431ca6e9b8c2fd80a5f72ed2024ef72a3c6fb10263c379937323338" ) . expect ( "should succeed" ) ,
427+ sequence : Sequence :: MAX ,
428+ witness : Witness :: new ( ) ,
429+ } ;
430430
431431 let expected_pubkey = PublicKey :: from_str (
432432 "03782eeb913431ca6e9b8c2fd80a5f72ed2024ef72a3c6fb10263c379937323338" ,
@@ -439,7 +439,7 @@ mod tests {
439439
440440 let ( input_type, parsed_pubkey) = maybe_pubkey. expect ( "is some" ) ;
441441
442- assert_eq ! ( SpInputs :: P2PKH , input_type) ;
442+ assert_eq ! ( SpInputs :: Pkh , input_type) ;
443443
444444 assert_eq ! ( expected_pubkey, parsed_pubkey) ;
445445 }
0 commit comments