@@ -21,12 +21,18 @@ use bitcoin::blockdata::transaction::{Transaction, EcdsaSighashType};
21
21
use bitcoin:: util:: sighash;
22
22
23
23
use bitcoin:: secp256k1;
24
+ #[ cfg( taproot) ]
25
+ use bitcoin:: secp256k1:: All ;
24
26
use bitcoin:: secp256k1:: { SecretKey , PublicKey } ;
25
27
use bitcoin:: secp256k1:: { Secp256k1 , ecdsa:: Signature } ;
28
+ #[ cfg( taproot) ]
29
+ use musig2:: types:: { PartialSignature , PublicNonce } ;
26
30
use crate :: events:: bump_transaction:: HTLCDescriptor ;
27
31
use crate :: util:: ser:: { Writeable , Writer } ;
28
32
use crate :: io:: Error ;
29
33
use crate :: ln:: features:: ChannelTypeFeatures ;
34
+ #[ cfg( taproot) ]
35
+ use crate :: sign:: taproot:: TaprootChannelSigner ;
30
36
31
37
/// Initial value for revoked commitment downward counter
32
38
pub const INITIAL_REVOKED_COMMITMENT_NUMBER : u64 = 1 << 48 ;
@@ -198,11 +204,11 @@ impl EcdsaChannelSigner for EnforcingSigner {
198
204
}
199
205
200
206
fn sign_justice_revoked_output ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , secp_ctx : & Secp256k1 < secp256k1:: All > ) -> Result < Signature , ( ) > {
201
- Ok ( self . inner . sign_justice_revoked_output ( justice_tx, input, amount, per_commitment_key, secp_ctx) . unwrap ( ) )
207
+ Ok ( EcdsaChannelSigner :: sign_justice_revoked_output ( & self . inner , justice_tx, input, amount, per_commitment_key, secp_ctx) . unwrap ( ) )
202
208
}
203
209
204
210
fn sign_justice_revoked_htlc ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < secp256k1:: All > ) -> Result < Signature , ( ) > {
205
- Ok ( self . inner . sign_justice_revoked_htlc ( justice_tx, input, amount, per_commitment_key, htlc, secp_ctx) . unwrap ( ) )
211
+ Ok ( EcdsaChannelSigner :: sign_justice_revoked_htlc ( & self . inner , justice_tx, input, amount, per_commitment_key, htlc, secp_ctx) . unwrap ( ) )
206
212
}
207
213
208
214
fn sign_holder_htlc_transaction (
@@ -211,11 +217,11 @@ impl EcdsaChannelSigner for EnforcingSigner {
211
217
) -> Result < Signature , ( ) > {
212
218
assert_eq ! ( htlc_tx. input[ input] , htlc_descriptor. unsigned_tx_input( ) ) ;
213
219
assert_eq ! ( htlc_tx. output[ input] , htlc_descriptor. tx_output( secp_ctx) ) ;
214
- Ok ( self . inner . sign_holder_htlc_transaction ( htlc_tx, input, htlc_descriptor, secp_ctx) . unwrap ( ) )
220
+ Ok ( EcdsaChannelSigner :: sign_holder_htlc_transaction ( & self . inner , htlc_tx, input, htlc_descriptor, secp_ctx) . unwrap ( ) )
215
221
}
216
222
217
223
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 , ( ) > {
218
- Ok ( self . inner . sign_counterparty_htlc_transaction ( htlc_tx, input, amount, per_commitment_point, htlc, secp_ctx) . unwrap ( ) )
224
+ Ok ( EcdsaChannelSigner :: sign_counterparty_htlc_transaction ( & self . inner , htlc_tx, input, amount, per_commitment_point, htlc, secp_ctx) . unwrap ( ) )
219
225
}
220
226
221
227
fn sign_closing_transaction ( & self , closing_tx : & ClosingTransaction , secp_ctx : & Secp256k1 < secp256k1:: All > ) -> Result < Signature , ( ) > {
@@ -231,7 +237,7 @@ impl EcdsaChannelSigner for EnforcingSigner {
231
237
// As long as our minimum dust limit is enforced and is greater than our anchor output
232
238
// value, an anchor output can only have an index within [0, 1].
233
239
assert ! ( anchor_tx. input[ input] . previous_output. vout == 0 || anchor_tx. input[ input] . previous_output. vout == 1 ) ;
234
- self . inner . sign_holder_anchor_input ( anchor_tx, input, secp_ctx)
240
+ EcdsaChannelSigner :: sign_holder_anchor_input ( & self . inner , anchor_tx, input, secp_ctx)
235
241
}
236
242
237
243
fn sign_channel_announcement_with_funding_key (
@@ -243,6 +249,45 @@ impl EcdsaChannelSigner for EnforcingSigner {
243
249
244
250
impl WriteableEcdsaChannelSigner for EnforcingSigner { }
245
251
252
+ #[ cfg( taproot) ]
253
+ impl TaprootChannelSigner for EnforcingSigner {
254
+ fn generate_local_nonce_pair ( & self , secp_ctx : & Secp256k1 < All > ) -> PublicNonce {
255
+ todo ! ( )
256
+ }
257
+
258
+ fn partially_sign_counterparty_commitment ( & self , commitment_tx : & CommitmentTransaction , preimages : Vec < PaymentPreimage > , secp_ctx : & Secp256k1 < All > ) -> Result < ( PartialSignature , Vec < secp256k1:: schnorr:: Signature > ) , ( ) > {
259
+ todo ! ( )
260
+ }
261
+
262
+ fn partially_sign_holder_commitment_and_htlcs ( & self , commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < All > ) -> Result < ( PartialSignature , Vec < secp256k1:: schnorr:: Signature > ) , ( ) > {
263
+ todo ! ( )
264
+ }
265
+
266
+ fn sign_justice_revoked_output ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
267
+ todo ! ( )
268
+ }
269
+
270
+ fn sign_justice_revoked_htlc ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
271
+ todo ! ( )
272
+ }
273
+
274
+ fn sign_holder_htlc_transaction ( & self , htlc_tx : & Transaction , input : usize , htlc_descriptor : & HTLCDescriptor , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
275
+ todo ! ( )
276
+ }
277
+
278
+ fn sign_counterparty_htlc_transaction ( & self , htlc_tx : & Transaction , input : usize , amount : u64 , per_commitment_point : & PublicKey , htlc : & HTLCOutputInCommitment , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
279
+ todo ! ( )
280
+ }
281
+
282
+ fn partially_sign_closing_transaction ( & self , closing_tx : & ClosingTransaction , secp_ctx : & Secp256k1 < All > ) -> Result < PartialSignature , ( ) > {
283
+ todo ! ( )
284
+ }
285
+
286
+ fn sign_holder_anchor_input ( & self , anchor_tx : & Transaction , input : usize , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
287
+ todo ! ( )
288
+ }
289
+ }
290
+
246
291
impl Writeable for EnforcingSigner {
247
292
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , Error > {
248
293
// EnforcingSigner has two fields - `inner` ([`InMemorySigner`]) and `state`
0 commit comments