@@ -27,7 +27,6 @@ compile_error!("at least one of the `std` or `no-std` features must be enabled")
2727
2828extern crate bech32;
2929extern crate lightning_types;
30- extern crate secp256k1;
3130extern crate alloc;
3231#[ cfg( any( test, feature = "std" ) ) ]
3332extern crate core;
@@ -42,9 +41,9 @@ use bitcoin::{Address, Network, PubkeyHash, ScriptHash, WitnessProgram, WitnessV
4241use bitcoin:: hashes:: { Hash , sha256} ;
4342use lightning_types:: features:: Bolt11InvoiceFeatures ;
4443
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 ;
4847
4948use core:: cmp:: Ordering ;
5049use core:: fmt:: { Display , Formatter , self } ;
@@ -84,7 +83,7 @@ use crate::prelude::*;
8483pub enum Bolt11ParseError {
8584 Bech32Error ( bech32:: Error ) ,
8685 ParseAmountError ( ParseIntError ) ,
87- MalformedSignature ( secp256k1:: Error ) ,
86+ MalformedSignature ( bitcoin :: secp256k1:: Error ) ,
8887 BadPrefix ,
8988 UnknownCurrency ,
9089 UnknownSiPrefix ,
@@ -141,15 +140,14 @@ pub const DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA: u64 = 18;
141140/// ensures that only a semantically and syntactically correct invoice can be built using it.
142141///
143142/// ```
144- /// extern crate secp256k1;
145143/// extern crate lightning_invoice;
146144/// extern crate bitcoin;
147145///
148146/// use bitcoin::hashes::Hash;
149147/// use bitcoin::hashes::sha256;
150148///
151- /// use secp256k1::Secp256k1;
152- /// use secp256k1::SecretKey;
149+ /// use bitcoin:: secp256k1::Secp256k1;
150+ /// use bitcoin:: secp256k1::SecretKey;
153151///
154152/// use lightning_types::payment::PaymentSecret;
155153///
@@ -866,7 +864,7 @@ impl SignedRawBolt11Invoice {
866864 }
867865
868866 /// 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 > {
870868 let hash = Message :: from_digest ( self . hash ) ;
871869
872870 Ok ( PayeePubKey ( Secp256k1 :: new ( ) . recover_ecdsa (
@@ -1248,9 +1246,9 @@ impl Bolt11Invoice {
12481246 /// Check that the invoice is signed correctly and that key recovery works
12491247 pub fn check_signature ( & self ) -> Result < ( ) , Bolt11SemanticError > {
12501248 match self . signed_invoice . recover_payee_pub_key ( ) {
1251- Err ( secp256k1:: Error :: InvalidRecoveryId ) =>
1249+ Err ( bitcoin :: secp256k1:: Error :: InvalidRecoveryId ) =>
12521250 return Err ( Bolt11SemanticError :: InvalidRecoveryId ) ,
1253- Err ( secp256k1:: Error :: InvalidSignature ) =>
1251+ Err ( bitcoin :: secp256k1:: Error :: InvalidSignature ) =>
12541252 return Err ( Bolt11SemanticError :: InvalidSignature ) ,
12551253 Err ( e) => panic ! ( "no other error may occur, got {:?}" , e) ,
12561254 Ok ( _) => { } ,
@@ -1811,9 +1809,9 @@ mod test {
18111809 #[ test]
18121810 fn test_check_signature ( ) {
18131811 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 } ;
18171815 use crate :: { SignedRawBolt11Invoice , Bolt11InvoiceSignature , RawBolt11Invoice , RawHrp , RawDataPart , Currency , Sha256 ,
18181816 PositiveTimestamp } ;
18191817
@@ -1881,8 +1879,8 @@ mod test {
18811879 fn test_check_feature_bits ( ) {
18821880 use crate :: TaggedField :: * ;
18831881 use lightning_types:: features:: Bolt11InvoiceFeatures ;
1884- use secp256k1:: Secp256k1 ;
1885- use secp256k1:: SecretKey ;
1882+ use bitcoin :: secp256k1:: Secp256k1 ;
1883+ use bitcoin :: secp256k1:: SecretKey ;
18861884 use crate :: { Bolt11Invoice , RawBolt11Invoice , RawHrp , RawDataPart , Currency , Sha256 , PositiveTimestamp ,
18871885 Bolt11SemanticError } ;
18881886
@@ -2003,7 +2001,7 @@ mod test {
20032001 use crate :: * ;
20042002 use lightning_types:: routing:: RouteHintHop ;
20052003 use std:: iter:: FromIterator ;
2006- use secp256k1:: PublicKey ;
2004+ use bitcoin :: secp256k1:: PublicKey ;
20072005
20082006 let builder = InvoiceBuilder :: new ( Currency :: Bitcoin )
20092007 . payment_hash ( sha256:: Hash :: from_slice ( & [ 0 ; 32 ] [ ..] ) . unwrap ( ) )
@@ -2056,8 +2054,8 @@ mod test {
20562054 fn test_builder_ok ( ) {
20572055 use crate :: * ;
20582056 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 } ;
20612059 use std:: time:: Duration ;
20622060
20632061 let secp_ctx = Secp256k1 :: new ( ) ;
@@ -2177,8 +2175,8 @@ mod test {
21772175 #[ test]
21782176 fn test_default_values ( ) {
21792177 use crate :: * ;
2180- use secp256k1:: Secp256k1 ;
2181- use secp256k1:: SecretKey ;
2178+ use bitcoin :: secp256k1:: Secp256k1 ;
2179+ use bitcoin :: secp256k1:: SecretKey ;
21822180
21832181 let signed_invoice = InvoiceBuilder :: new ( Currency :: Bitcoin )
21842182 . description ( "Test" . into ( ) )
@@ -2203,8 +2201,8 @@ mod test {
22032201 #[ test]
22042202 fn test_expiration ( ) {
22052203 use crate :: * ;
2206- use secp256k1:: Secp256k1 ;
2207- use secp256k1:: SecretKey ;
2204+ use bitcoin :: secp256k1:: Secp256k1 ;
2205+ use bitcoin :: secp256k1:: SecretKey ;
22082206
22092207 let signed_invoice = InvoiceBuilder :: new ( Currency :: Bitcoin )
22102208 . description ( "Test" . into ( ) )
0 commit comments