@@ -230,7 +230,7 @@ pub trait Sign : Send+Clone + Writeable {
230
230
/// Gets the per-commitment point for a specific commitment number
231
231
///
232
232
/// Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
233
- fn get_per_commitment_point < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , idx : u64 , secp_ctx : & Secp256k1 < T > ) -> PublicKey ;
233
+ fn get_per_commitment_point ( & self , idx : u64 , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> PublicKey ;
234
234
/// Gets the commitment secret for a specific commitment number as part of the revocation process
235
235
///
236
236
/// An external signer implementation should error here if the commitment was already signed
@@ -253,7 +253,7 @@ pub trait Sign : Send+Clone + Writeable {
253
253
/// Note that if signing fails or is rejected, the channel will be force-closed.
254
254
//
255
255
// TODO: Document the things someone using this interface should enforce before signing.
256
- fn sign_counterparty_commitment < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , commitment_tx : & CommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
256
+ fn sign_counterparty_commitment ( & self , commitment_tx : & CommitmentTransaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
257
257
258
258
/// Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
259
259
/// This will only ever be called with a non-revoked commitment_tx. This will be called with the
@@ -269,14 +269,14 @@ pub trait Sign : Send+Clone + Writeable {
269
269
//
270
270
// TODO: Document the things someone using this interface should enforce before signing.
271
271
// TODO: Key derivation failure should panic rather than Err
272
- fn sign_holder_commitment_and_htlcs < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
272
+ fn sign_holder_commitment_and_htlcs ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
273
273
274
274
/// Same as sign_holder_commitment, but exists only for tests to get access to holder commitment
275
275
/// transactions which will be broadcasted later, after the channel has moved on to a newer
276
276
/// state. Thus, needs its own method as sign_holder_commitment may enforce that we only ever
277
277
/// get called once.
278
278
#[ cfg( any( test, feature = "unsafe_revoked_tx_signing" ) ) ]
279
- fn unsafe_sign_holder_commitment_and_htlcs < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
279
+ fn unsafe_sign_holder_commitment_and_htlcs ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > ;
280
280
281
281
/// Create a signature for the given input in a transaction spending an HTLC or commitment
282
282
/// transaction output when our counterparty broadcasts an old state.
@@ -296,7 +296,7 @@ pub trait Sign : Send+Clone + Writeable {
296
296
/// htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
297
297
/// changing the format of the witness script (which is committed to in the BIP 143
298
298
/// signatures).
299
- fn sign_justice_transaction < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & Option < HTLCOutputInCommitment > , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
299
+ fn sign_justice_transaction ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & Option < HTLCOutputInCommitment > , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > ;
300
300
301
301
/// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
302
302
/// transaction, either offered or received.
@@ -315,21 +315,21 @@ pub trait Sign : Send+Clone + Writeable {
315
315
/// detected onchain. It has been generated by our counterparty and is used to derive
316
316
/// channel state keys, which are then included in the witness script and committed to in the
317
317
/// BIP 143 signature.
318
- fn sign_counterparty_htlc_transaction < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
318
+ fn sign_counterparty_htlc_transaction ( & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > ;
319
319
320
320
/// Create a signature for a (proposed) closing transaction.
321
321
///
322
322
/// Note that, due to rounding, there may be one "missing" satoshi, and either party may have
323
323
/// chosen to forgo their output as dust.
324
- fn sign_closing_transaction < T : secp256k1 :: Signing > ( & self , closing_tx : & Transaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
324
+ fn sign_closing_transaction ( & self , closing_tx : & Transaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > ;
325
325
326
326
/// Signs a channel announcement message with our funding key, proving it comes from one
327
327
/// of the channel participants.
328
328
///
329
329
/// Note that if this fails or is rejected, the channel will not be publicly announced and
330
330
/// our counterparty may (though likely will not) close the channel on us for violating the
331
331
/// protocol.
332
- fn sign_channel_announcement < T : secp256k1 :: Signing > ( & self , msg : & UnsignedChannelAnnouncement , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > ;
332
+ fn sign_channel_announcement ( & self , msg : & UnsignedChannelAnnouncement , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > ;
333
333
334
334
/// Set the counterparty static channel data, including basepoints,
335
335
/// counterparty_selected/holder_selected_contest_delay and funding outpoint.
@@ -550,7 +550,7 @@ impl InMemorySigner {
550
550
}
551
551
552
552
impl Sign for InMemorySigner {
553
- fn get_per_commitment_point < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , idx : u64 , secp_ctx : & Secp256k1 < T > ) -> PublicKey {
553
+ fn get_per_commitment_point ( & self , idx : u64 , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> PublicKey {
554
554
let commitment_secret = SecretKey :: from_slice ( & chan_utils:: build_commitment_secret ( & self . commitment_seed , idx) ) . unwrap ( ) ;
555
555
PublicKey :: from_secret_key ( secp_ctx, & commitment_secret)
556
556
}
@@ -562,7 +562,7 @@ impl Sign for InMemorySigner {
562
562
fn pubkeys ( & self ) -> & ChannelPublicKeys { & self . holder_channel_pubkeys }
563
563
fn channel_keys_id ( & self ) -> [ u8 ; 32 ] { self . channel_keys_id }
564
564
565
- fn sign_counterparty_commitment < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , commitment_tx : & CommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
565
+ fn sign_counterparty_commitment ( & self , commitment_tx : & CommitmentTransaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
566
566
let trusted_tx = commitment_tx. trust ( ) ;
567
567
let keys = trusted_tx. keys ( ) ;
568
568
@@ -588,7 +588,7 @@ impl Sign for InMemorySigner {
588
588
Ok ( ( commitment_sig, htlc_sigs) )
589
589
}
590
590
591
- fn sign_holder_commitment_and_htlcs < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
591
+ fn sign_holder_commitment_and_htlcs ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
592
592
let funding_pubkey = PublicKey :: from_secret_key ( secp_ctx, & self . funding_key ) ;
593
593
let funding_redeemscript = make_funding_redeemscript ( & funding_pubkey, & self . counterparty_pubkeys ( ) . funding_pubkey ) ;
594
594
let trusted_tx = commitment_tx. trust ( ) ;
@@ -599,7 +599,7 @@ impl Sign for InMemorySigner {
599
599
}
600
600
601
601
#[ cfg( any( test, feature = "unsafe_revoked_tx_signing" ) ) ]
602
- fn unsafe_sign_holder_commitment_and_htlcs < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < T > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
602
+ fn unsafe_sign_holder_commitment_and_htlcs ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < ( Signature , Vec < Signature > ) , ( ) > {
603
603
let funding_pubkey = PublicKey :: from_secret_key ( secp_ctx, & self . funding_key ) ;
604
604
let funding_redeemscript = make_funding_redeemscript ( & funding_pubkey, & self . counterparty_pubkeys ( ) . funding_pubkey ) ;
605
605
let trusted_tx = commitment_tx. trust ( ) ;
@@ -609,7 +609,7 @@ impl Sign for InMemorySigner {
609
609
Ok ( ( sig, htlc_sigs) )
610
610
}
611
611
612
- fn sign_justice_transaction < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & Option < HTLCOutputInCommitment > , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
612
+ fn sign_justice_transaction ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & Option < HTLCOutputInCommitment > , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > {
613
613
let revocation_key = match chan_utils:: derive_private_revocation_key ( & secp_ctx, & per_commitment_key, & self . revocation_base_key ) {
614
614
Ok ( revocation_key) => revocation_key,
615
615
Err ( _) => return Err ( ( ) )
@@ -641,7 +641,7 @@ impl Sign for InMemorySigner {
641
641
return Ok ( secp_ctx. sign ( & sighash, & revocation_key) )
642
642
}
643
643
644
- fn sign_counterparty_htlc_transaction < T : secp256k1 :: Signing + secp256k1 :: Verification > ( & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
644
+ fn sign_counterparty_htlc_transaction ( & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > {
645
645
if let Ok ( htlc_key) = chan_utils:: derive_private_key ( & secp_ctx, & per_commitment_point, & self . htlc_base_key ) {
646
646
let witness_script = if let Ok ( revocation_pubkey) = chan_utils:: derive_public_revocation_key ( & secp_ctx, & per_commitment_point, & self . pubkeys ( ) . revocation_basepoint ) {
647
647
if let Ok ( counterparty_htlcpubkey) = chan_utils:: derive_public_key ( & secp_ctx, & per_commitment_point, & self . counterparty_pubkeys ( ) . htlc_basepoint ) {
@@ -657,7 +657,7 @@ impl Sign for InMemorySigner {
657
657
Err ( ( ) )
658
658
}
659
659
660
- fn sign_closing_transaction < T : secp256k1 :: Signing > ( & self , closing_tx : & Transaction , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
660
+ fn sign_closing_transaction ( & self , closing_tx : & Transaction , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > {
661
661
if closing_tx. input . len ( ) != 1 { return Err ( ( ) ) ; }
662
662
if closing_tx. input [ 0 ] . witness . len ( ) != 0 { return Err ( ( ) ) ; }
663
663
if closing_tx. output . len ( ) > 2 { return Err ( ( ) ) ; }
@@ -670,7 +670,7 @@ impl Sign for InMemorySigner {
670
670
Ok ( secp_ctx. sign ( & sighash, & self . funding_key ) )
671
671
}
672
672
673
- fn sign_channel_announcement < T : secp256k1 :: Signing > ( & self , msg : & UnsignedChannelAnnouncement , secp_ctx : & Secp256k1 < T > ) -> Result < Signature , ( ) > {
673
+ fn sign_channel_announcement ( & self , msg : & UnsignedChannelAnnouncement , secp_ctx : & Secp256k1 < secp256k1 :: All > ) -> Result < Signature , ( ) > {
674
674
let msghash = hash_to_message ! ( & Sha256dHash :: hash( & msg. encode( ) [ ..] ) [ ..] ) ;
675
675
Ok ( secp_ctx. sign ( & msghash, & self . funding_key ) )
676
676
}
@@ -738,7 +738,7 @@ impl Readable for InMemorySigner {
738
738
/// Cooperative closes may use seed/2'
739
739
/// The two close keys may be needed to claim on-chain funds!
740
740
pub struct KeysManager {
741
- secp_ctx : Secp256k1 < secp256k1:: SignOnly > ,
741
+ secp_ctx : Secp256k1 < secp256k1:: All > ,
742
742
node_secret : SecretKey ,
743
743
destination_script : Script ,
744
744
shutdown_pubkey : PublicKey ,
@@ -775,7 +775,7 @@ impl KeysManager {
775
775
/// versions. Once the library is more fully supported, the docs will be updated to include a
776
776
/// detailed description of the guarantee.
777
777
pub fn new ( seed : & [ u8 ; 32 ] , starting_time_secs : u64 , starting_time_nanos : u32 ) -> Self {
778
- let secp_ctx = Secp256k1 :: signing_only ( ) ;
778
+ let secp_ctx = Secp256k1 :: new ( ) ;
779
779
// Note that when we aren't serializing the key, network doesn't matter
780
780
match ExtendedPrivKey :: new_master ( Network :: Testnet , seed) {
781
781
Ok ( master_key) => {
0 commit comments