@@ -47,9 +47,9 @@ use lightning::routing::network_graph::RoutingFees;
47
47
use lightning:: routing:: router:: RouteHint ;
48
48
use lightning:: util:: invoice:: construct_invoice_preimage;
49
49
50
- use secp256k1:: key :: PublicKey ;
50
+ use secp256k1:: PublicKey ;
51
51
use secp256k1:: { Message , Secp256k1 } ;
52
- use secp256k1:: recovery :: RecoverableSignature ;
52
+ use secp256k1:: ecdsa :: RecoverableSignature ;
53
53
54
54
use core:: fmt:: { Display , Formatter , self } ;
55
55
use core:: iter:: FilterMap ;
@@ -163,7 +163,7 @@ pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY: u64 = 18;
163
163
/// use bitcoin_hashes::sha256;
164
164
///
165
165
/// use secp256k1::Secp256k1;
166
- /// use secp256k1::key:: SecretKey;
166
+ /// use secp256k1::SecretKey;
167
167
///
168
168
/// use lightning::ln::PaymentSecret;
169
169
///
@@ -191,7 +191,7 @@ pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY: u64 = 18;
191
191
/// .current_timestamp()
192
192
/// .min_final_cltv_expiry(144)
193
193
/// .build_signed(|hash| {
194
- /// Secp256k1::new().sign_recoverable (hash, &private_key)
194
+ /// Secp256k1::new().sign_ecdsa_recoverable (hash, &private_key)
195
195
/// })
196
196
/// .unwrap();
197
197
///
@@ -749,7 +749,7 @@ impl SignedRawInvoice {
749
749
let hash = Message :: from_slice ( & self . hash [ ..] )
750
750
. expect ( "Hash is 32 bytes long, same as MESSAGE_SIZE" ) ;
751
751
752
- Ok ( PayeePubKey ( Secp256k1 :: new ( ) . recover (
752
+ Ok ( PayeePubKey ( Secp256k1 :: new ( ) . recover_ecdsa (
753
753
& hash,
754
754
& self . signature
755
755
) ?) )
@@ -776,7 +776,7 @@ impl SignedRawInvoice {
776
776
. expect ( "Hash is 32 bytes long, same as MESSAGE_SIZE" ) ;
777
777
778
778
let secp_context = Secp256k1 :: new ( ) ;
779
- let verification_result = secp_context. verify (
779
+ let verification_result = secp_context. verify_ecdsa (
780
780
& hash,
781
781
& self . signature . to_standard ( ) ,
782
782
pub_key
@@ -1576,8 +1576,8 @@ mod test {
1576
1576
fn test_check_signature ( ) {
1577
1577
use TaggedField :: * ;
1578
1578
use secp256k1:: Secp256k1 ;
1579
- use secp256k1:: recovery :: { RecoveryId , RecoverableSignature } ;
1580
- use secp256k1:: key :: { SecretKey , PublicKey } ;
1579
+ use secp256k1:: ecdsa :: { RecoveryId , RecoverableSignature } ;
1580
+ use secp256k1:: { SecretKey , PublicKey } ;
1581
1581
use { SignedRawInvoice , InvoiceSignature , RawInvoice , RawHrp , RawDataPart , Currency , Sha256 ,
1582
1582
PositiveTimestamp } ;
1583
1583
@@ -1635,7 +1635,7 @@ mod test {
1635
1635
1636
1636
let ( raw_invoice, _, _) = invoice. into_parts ( ) ;
1637
1637
let new_signed = raw_invoice. sign :: < _ , ( ) > ( |hash| {
1638
- Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) )
1638
+ Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) )
1639
1639
} ) . unwrap ( ) ;
1640
1640
1641
1641
assert ! ( new_signed. check_signature( ) ) ;
@@ -1646,7 +1646,7 @@ mod test {
1646
1646
use TaggedField :: * ;
1647
1647
use lightning:: ln:: features:: InvoiceFeatures ;
1648
1648
use secp256k1:: Secp256k1 ;
1649
- use secp256k1:: key :: SecretKey ;
1649
+ use secp256k1:: SecretKey ;
1650
1650
use { RawInvoice , RawHrp , RawDataPart , Currency , Sha256 , PositiveTimestamp , Invoice ,
1651
1651
SemanticError } ;
1652
1652
@@ -1677,7 +1677,7 @@ mod test {
1677
1677
let invoice = {
1678
1678
let mut invoice = invoice_template. clone ( ) ;
1679
1679
invoice. data . tagged_fields . push ( PaymentSecret ( payment_secret) . into ( ) ) ;
1680
- invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) ) )
1680
+ invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1681
1681
} . unwrap ( ) ;
1682
1682
assert_eq ! ( Invoice :: from_signed( invoice) , Err ( SemanticError :: InvalidFeatures ) ) ;
1683
1683
@@ -1686,7 +1686,7 @@ mod test {
1686
1686
let mut invoice = invoice_template. clone ( ) ;
1687
1687
invoice. data . tagged_fields . push ( PaymentSecret ( payment_secret) . into ( ) ) ;
1688
1688
invoice. data . tagged_fields . push ( Features ( InvoiceFeatures :: empty ( ) ) . into ( ) ) ;
1689
- invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) ) )
1689
+ invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1690
1690
} . unwrap ( ) ;
1691
1691
assert_eq ! ( Invoice :: from_signed( invoice) , Err ( SemanticError :: InvalidFeatures ) ) ;
1692
1692
@@ -1695,30 +1695,30 @@ mod test {
1695
1695
let mut invoice = invoice_template. clone ( ) ;
1696
1696
invoice. data . tagged_fields . push ( PaymentSecret ( payment_secret) . into ( ) ) ;
1697
1697
invoice. data . tagged_fields . push ( Features ( InvoiceFeatures :: known ( ) ) . into ( ) ) ;
1698
- invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) ) )
1698
+ invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1699
1699
} . unwrap ( ) ;
1700
1700
assert ! ( Invoice :: from_signed( invoice) . is_ok( ) ) ;
1701
1701
1702
1702
// No payment secret or features
1703
1703
let invoice = {
1704
1704
let invoice = invoice_template. clone ( ) ;
1705
- invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) ) )
1705
+ invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1706
1706
} . unwrap ( ) ;
1707
1707
assert_eq ! ( Invoice :: from_signed( invoice) , Err ( SemanticError :: NoPaymentSecret ) ) ;
1708
1708
1709
1709
// No payment secret or feature bits
1710
1710
let invoice = {
1711
1711
let mut invoice = invoice_template. clone ( ) ;
1712
1712
invoice. data . tagged_fields . push ( Features ( InvoiceFeatures :: empty ( ) ) . into ( ) ) ;
1713
- invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) ) )
1713
+ invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1714
1714
} . unwrap ( ) ;
1715
1715
assert_eq ! ( Invoice :: from_signed( invoice) , Err ( SemanticError :: NoPaymentSecret ) ) ;
1716
1716
1717
1717
// Missing payment secret
1718
1718
let invoice = {
1719
1719
let mut invoice = invoice_template. clone ( ) ;
1720
1720
invoice. data . tagged_fields . push ( Features ( InvoiceFeatures :: known ( ) ) . into ( ) ) ;
1721
- invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) ) )
1721
+ invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1722
1722
} . unwrap ( ) ;
1723
1723
assert_eq ! ( Invoice :: from_signed( invoice) , Err ( SemanticError :: NoPaymentSecret ) ) ;
1724
1724
@@ -1727,7 +1727,7 @@ mod test {
1727
1727
let mut invoice = invoice_template. clone ( ) ;
1728
1728
invoice. data . tagged_fields . push ( PaymentSecret ( payment_secret) . into ( ) ) ;
1729
1729
invoice. data . tagged_fields . push ( PaymentSecret ( payment_secret) . into ( ) ) ;
1730
- invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_recoverable ( hash, & private_key) ) )
1730
+ invoice. sign :: < _ , ( ) > ( |hash| Ok ( Secp256k1 :: new ( ) . sign_ecdsa_recoverable ( hash, & private_key) ) )
1731
1731
} . unwrap ( ) ;
1732
1732
assert_eq ! ( Invoice :: from_signed( invoice) , Err ( SemanticError :: MultiplePaymentSecrets ) ) ;
1733
1733
}
@@ -1764,7 +1764,7 @@ mod test {
1764
1764
use :: * ;
1765
1765
use lightning:: routing:: router:: RouteHintHop ;
1766
1766
use std:: iter:: FromIterator ;
1767
- use secp256k1:: key :: PublicKey ;
1767
+ use secp256k1:: PublicKey ;
1768
1768
1769
1769
let builder = InvoiceBuilder :: new ( Currency :: Bitcoin )
1770
1770
. payment_hash ( sha256:: Hash :: from_slice ( & [ 0 ; 32 ] [ ..] ) . unwrap ( ) )
@@ -1818,7 +1818,7 @@ mod test {
1818
1818
use :: * ;
1819
1819
use lightning:: routing:: router:: RouteHintHop ;
1820
1820
use secp256k1:: Secp256k1 ;
1821
- use secp256k1:: key :: { SecretKey , PublicKey } ;
1821
+ use secp256k1:: { SecretKey , PublicKey } ;
1822
1822
use std:: time:: { UNIX_EPOCH , Duration } ;
1823
1823
1824
1824
let secp_ctx = Secp256k1 :: new ( ) ;
@@ -1897,7 +1897,7 @@ mod test {
1897
1897
. basic_mpp ( ) ;
1898
1898
1899
1899
let invoice = builder. clone ( ) . build_signed ( |hash| {
1900
- secp_ctx. sign_recoverable ( hash, & private_key)
1900
+ secp_ctx. sign_ecdsa_recoverable ( hash, & private_key)
1901
1901
} ) . unwrap ( ) ;
1902
1902
1903
1903
assert ! ( invoice. check_signature( ) . is_ok( ) ) ;
@@ -1932,7 +1932,7 @@ mod test {
1932
1932
fn test_default_values ( ) {
1933
1933
use :: * ;
1934
1934
use secp256k1:: Secp256k1 ;
1935
- use secp256k1:: key :: SecretKey ;
1935
+ use secp256k1:: SecretKey ;
1936
1936
1937
1937
let signed_invoice = InvoiceBuilder :: new ( Currency :: Bitcoin )
1938
1938
. description ( "Test" . into ( ) )
@@ -1944,7 +1944,7 @@ mod test {
1944
1944
. sign :: < _ , ( ) > ( |hash| {
1945
1945
let privkey = SecretKey :: from_slice ( & [ 41 ; 32 ] ) . unwrap ( ) ;
1946
1946
let secp_ctx = Secp256k1 :: new ( ) ;
1947
- Ok ( secp_ctx. sign_recoverable ( hash, & privkey) )
1947
+ Ok ( secp_ctx. sign_ecdsa_recoverable ( hash, & privkey) )
1948
1948
} )
1949
1949
. unwrap ( ) ;
1950
1950
let invoice = Invoice :: from_signed ( signed_invoice) . unwrap ( ) ;
@@ -1958,7 +1958,7 @@ mod test {
1958
1958
fn test_expiration ( ) {
1959
1959
use :: * ;
1960
1960
use secp256k1:: Secp256k1 ;
1961
- use secp256k1:: key :: SecretKey ;
1961
+ use secp256k1:: SecretKey ;
1962
1962
1963
1963
let signed_invoice = InvoiceBuilder :: new ( Currency :: Bitcoin )
1964
1964
. description ( "Test" . into ( ) )
@@ -1970,7 +1970,7 @@ mod test {
1970
1970
. sign :: < _ , ( ) > ( |hash| {
1971
1971
let privkey = SecretKey :: from_slice ( & [ 41 ; 32 ] ) . unwrap ( ) ;
1972
1972
let secp_ctx = Secp256k1 :: new ( ) ;
1973
- Ok ( secp_ctx. sign_recoverable ( hash, & privkey) )
1973
+ Ok ( secp_ctx. sign_ecdsa_recoverable ( hash, & privkey) )
1974
1974
} )
1975
1975
. unwrap ( ) ;
1976
1976
let invoice = Invoice :: from_signed ( signed_invoice) . unwrap ( ) ;
0 commit comments