@@ -27,7 +27,6 @@ compile_error!("at least one of the `std` or `no-std` features must be enabled")
27
27
28
28
extern crate bech32;
29
29
extern crate lightning_types;
30
- extern crate secp256k1;
31
30
extern crate alloc;
32
31
#[ cfg( any( test, feature = "std" ) ) ]
33
32
extern crate core;
@@ -42,9 +41,9 @@ use bitcoin::{Address, Network, PubkeyHash, ScriptHash, WitnessProgram, WitnessV
42
41
use bitcoin:: hashes:: { Hash , sha256} ;
43
42
use lightning_types:: features:: Bolt11InvoiceFeatures ;
44
43
45
- use secp256k1:: PublicKey ;
46
- use secp256k1:: { Message , Secp256k1 } ;
47
- use secp256k1:: ecdsa:: RecoverableSignature ;
44
+ use bitcoin :: secp256k1:: PublicKey ;
45
+ use bitcoin :: secp256k1:: { Message , Secp256k1 } ;
46
+ use bitcoin :: secp256k1:: ecdsa:: RecoverableSignature ;
48
47
49
48
use core:: cmp:: Ordering ;
50
49
use core:: fmt:: { Display , Formatter , self } ;
@@ -84,7 +83,7 @@ use crate::prelude::*;
84
83
pub enum Bolt11ParseError {
85
84
Bech32Error ( bech32:: Error ) ,
86
85
ParseAmountError ( ParseIntError ) ,
87
- MalformedSignature ( secp256k1:: Error ) ,
86
+ MalformedSignature ( bitcoin :: secp256k1:: Error ) ,
88
87
BadPrefix ,
89
88
UnknownCurrency ,
90
89
UnknownSiPrefix ,
@@ -141,15 +140,14 @@ pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA: u64 = 18;
141
140
/// ensures that only a semantically and syntactically correct invoice can be built using it.
142
141
///
143
142
/// ```
144
- /// extern crate secp256k1;
145
143
/// extern crate lightning_invoice;
146
144
/// extern crate bitcoin;
147
145
///
148
146
/// use bitcoin::hashes::Hash;
149
147
/// use bitcoin::hashes::sha256;
150
148
///
151
- /// use secp256k1::Secp256k1;
152
- /// use secp256k1::SecretKey;
149
+ /// use bitcoin:: secp256k1::Secp256k1;
150
+ /// use bitcoin:: secp256k1::SecretKey;
153
151
///
154
152
/// use lightning_types::payment::PaymentSecret;
155
153
///
@@ -866,7 +864,7 @@ impl SignedRawBolt11Invoice {
866
864
}
867
865
868
866
/// Recovers the public key used for signing the invoice from the recoverable signature.
869
- pub fn recover_payee_pub_key ( & self ) -> Result < PayeePubKey , secp256k1:: Error > {
867
+ pub fn recover_payee_pub_key ( & self ) -> Result < PayeePubKey , bitcoin :: secp256k1:: Error > {
870
868
let hash = Message :: from_digest ( self . hash ) ;
871
869
872
870
Ok ( PayeePubKey ( Secp256k1 :: new ( ) . recover_ecdsa (
@@ -1248,9 +1246,9 @@ impl Bolt11Invoice {
1248
1246
/// Check that the invoice is signed correctly and that key recovery works
1249
1247
pub fn check_signature ( & self ) -> Result < ( ) , Bolt11SemanticError > {
1250
1248
match self . signed_invoice . recover_payee_pub_key ( ) {
1251
- Err ( secp256k1:: Error :: InvalidRecoveryId ) =>
1249
+ Err ( bitcoin :: secp256k1:: Error :: InvalidRecoveryId ) =>
1252
1250
return Err ( Bolt11SemanticError :: InvalidRecoveryId ) ,
1253
- Err ( secp256k1:: Error :: InvalidSignature ) =>
1251
+ Err ( bitcoin :: secp256k1:: Error :: InvalidSignature ) =>
1254
1252
return Err ( Bolt11SemanticError :: InvalidSignature ) ,
1255
1253
Err ( e) => panic ! ( "no other error may occur, got {:?}" , e) ,
1256
1254
Ok ( _) => { } ,
@@ -1811,9 +1809,9 @@ mod test {
1811
1809
#[ test]
1812
1810
fn test_check_signature ( ) {
1813
1811
use crate :: TaggedField :: * ;
1814
- use secp256k1:: Secp256k1 ;
1815
- use secp256k1:: ecdsa:: { RecoveryId , RecoverableSignature } ;
1816
- use secp256k1:: { SecretKey , PublicKey } ;
1812
+ use bitcoin :: secp256k1:: Secp256k1 ;
1813
+ use bitcoin :: secp256k1:: ecdsa:: { RecoveryId , RecoverableSignature } ;
1814
+ use bitcoin :: secp256k1:: { SecretKey , PublicKey } ;
1817
1815
use crate :: { SignedRawBolt11Invoice , Bolt11InvoiceSignature , RawBolt11Invoice , RawHrp , RawDataPart , Currency , Sha256 ,
1818
1816
PositiveTimestamp } ;
1819
1817
@@ -1881,8 +1879,8 @@ mod test {
1881
1879
fn test_check_feature_bits ( ) {
1882
1880
use crate :: TaggedField :: * ;
1883
1881
use lightning_types:: features:: Bolt11InvoiceFeatures ;
1884
- use secp256k1:: Secp256k1 ;
1885
- use secp256k1:: SecretKey ;
1882
+ use bitcoin :: secp256k1:: Secp256k1 ;
1883
+ use bitcoin :: secp256k1:: SecretKey ;
1886
1884
use crate :: { Bolt11Invoice , RawBolt11Invoice , RawHrp , RawDataPart , Currency , Sha256 , PositiveTimestamp ,
1887
1885
Bolt11SemanticError } ;
1888
1886
@@ -2003,7 +2001,7 @@ mod test {
2003
2001
use crate :: * ;
2004
2002
use lightning_types:: routing:: RouteHintHop ;
2005
2003
use std:: iter:: FromIterator ;
2006
- use secp256k1:: PublicKey ;
2004
+ use bitcoin :: secp256k1:: PublicKey ;
2007
2005
2008
2006
let builder = InvoiceBuilder :: new ( Currency :: Bitcoin )
2009
2007
. payment_hash ( sha256:: Hash :: from_slice ( & [ 0 ; 32 ] [ ..] ) . unwrap ( ) )
@@ -2056,8 +2054,8 @@ mod test {
2056
2054
fn test_builder_ok ( ) {
2057
2055
use crate :: * ;
2058
2056
use lightning_types:: routing:: RouteHintHop ;
2059
- use secp256k1:: Secp256k1 ;
2060
- use secp256k1:: { SecretKey , PublicKey } ;
2057
+ use bitcoin :: secp256k1:: Secp256k1 ;
2058
+ use bitcoin :: secp256k1:: { SecretKey , PublicKey } ;
2061
2059
use std:: time:: Duration ;
2062
2060
2063
2061
let secp_ctx = Secp256k1 :: new ( ) ;
@@ -2177,8 +2175,8 @@ mod test {
2177
2175
#[ test]
2178
2176
fn test_default_values ( ) {
2179
2177
use crate :: * ;
2180
- use secp256k1:: Secp256k1 ;
2181
- use secp256k1:: SecretKey ;
2178
+ use bitcoin :: secp256k1:: Secp256k1 ;
2179
+ use bitcoin :: secp256k1:: SecretKey ;
2182
2180
2183
2181
let signed_invoice = InvoiceBuilder :: new ( Currency :: Bitcoin )
2184
2182
. description ( "Test" . into ( ) )
@@ -2203,8 +2201,8 @@ mod test {
2203
2201
#[ test]
2204
2202
fn test_expiration ( ) {
2205
2203
use crate :: * ;
2206
- use secp256k1:: Secp256k1 ;
2207
- use secp256k1:: SecretKey ;
2204
+ use bitcoin :: secp256k1:: Secp256k1 ;
2205
+ use bitcoin :: secp256k1:: SecretKey ;
2208
2206
2209
2207
let signed_invoice = InvoiceBuilder :: new ( Currency :: Bitcoin )
2210
2208
. description ( "Test" . into ( ) )
0 commit comments