@@ -24,12 +24,20 @@ use bitcoin::sighash;
24
24
use bitcoin:: sighash:: EcdsaSighashType ;
25
25
26
26
use bitcoin:: secp256k1;
27
+ #[ cfg( taproot) ]
28
+ use bitcoin:: secp256k1:: All ;
27
29
use bitcoin:: secp256k1:: { SecretKey , PublicKey } ;
28
30
use bitcoin:: secp256k1:: { Secp256k1 , ecdsa:: Signature } ;
31
+ #[ cfg( taproot) ]
32
+ use musig2:: types:: { PartialSignature , PublicNonce , SecretNonce } ;
29
33
use crate :: sign:: HTLCDescriptor ;
30
34
use crate :: util:: ser:: { Writeable , Writer } ;
31
35
use crate :: io:: Error ;
32
36
use crate :: ln:: features:: ChannelTypeFeatures ;
37
+ #[ cfg( taproot) ]
38
+ use crate :: ln:: msgs:: PartialSignatureWithNonce ;
39
+ #[ cfg( taproot) ]
40
+ use crate :: sign:: taproot:: TaprootChannelSigner ;
33
41
34
42
/// Initial value for revoked commitment downward counter
35
43
pub const INITIAL_REVOKED_COMMITMENT_NUMBER : u64 = 1 << 48 ;
@@ -201,11 +209,11 @@ impl EcdsaChannelSigner for TestChannelSigner {
201
209
}
202
210
203
211
fn sign_justice_revoked_output ( & self , justice_tx : & Transaction , input : usize , amount : u64 , per_commitment_key : & SecretKey , secp_ctx : & Secp256k1 < secp256k1:: All > ) -> Result < Signature , ( ) > {
204
- Ok ( self . inner . sign_justice_revoked_output ( justice_tx, input, amount, per_commitment_key, secp_ctx) . unwrap ( ) )
212
+ Ok ( EcdsaChannelSigner :: sign_justice_revoked_output ( & self . inner , justice_tx, input, amount, per_commitment_key, secp_ctx) . unwrap ( ) )
205
213
}
206
214
207
215
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 , ( ) > {
208
- Ok ( self . inner . sign_justice_revoked_htlc ( justice_tx, input, amount, per_commitment_key, htlc, secp_ctx) . unwrap ( ) )
216
+ Ok ( EcdsaChannelSigner :: sign_justice_revoked_htlc ( & self . inner , justice_tx, input, amount, per_commitment_key, htlc, secp_ctx) . unwrap ( ) )
209
217
}
210
218
211
219
fn sign_holder_htlc_transaction (
@@ -241,11 +249,11 @@ impl EcdsaChannelSigner for TestChannelSigner {
241
249
& hash_to_message ! ( sighash. as_byte_array( ) ) , & htlc_descriptor. counterparty_sig , & countersignatory_htlc_key. to_public_key ( )
242
250
) . unwrap ( ) ;
243
251
}
244
- Ok ( self . inner . sign_holder_htlc_transaction ( htlc_tx, input, htlc_descriptor, secp_ctx) . unwrap ( ) )
252
+ Ok ( EcdsaChannelSigner :: sign_holder_htlc_transaction ( & self . inner , htlc_tx, input, htlc_descriptor, secp_ctx) . unwrap ( ) )
245
253
}
246
254
247
255
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 , ( ) > {
248
- Ok ( self . inner . sign_counterparty_htlc_transaction ( htlc_tx, input, amount, per_commitment_point, htlc, secp_ctx) . unwrap ( ) )
256
+ Ok ( EcdsaChannelSigner :: sign_counterparty_htlc_transaction ( & self . inner , htlc_tx, input, amount, per_commitment_point, htlc, secp_ctx) . unwrap ( ) )
249
257
}
250
258
251
259
fn sign_closing_transaction ( & self , closing_tx : & ClosingTransaction , secp_ctx : & Secp256k1 < secp256k1:: All > ) -> Result < Signature , ( ) > {
@@ -261,7 +269,7 @@ impl EcdsaChannelSigner for TestChannelSigner {
261
269
// As long as our minimum dust limit is enforced and is greater than our anchor output
262
270
// value, an anchor output can only have an index within [0, 1].
263
271
assert ! ( anchor_tx. input[ input] . previous_output. vout == 0 || anchor_tx. input[ input] . previous_output. vout == 1 ) ;
264
- self . inner . sign_holder_anchor_input ( anchor_tx, input, secp_ctx)
272
+ EcdsaChannelSigner :: sign_holder_anchor_input ( & self . inner , anchor_tx, input, secp_ctx)
265
273
}
266
274
267
275
fn sign_channel_announcement_with_funding_key (
@@ -273,6 +281,45 @@ impl EcdsaChannelSigner for TestChannelSigner {
273
281
274
282
impl WriteableEcdsaChannelSigner for TestChannelSigner { }
275
283
284
+ #[ cfg( taproot) ]
285
+ impl TaprootChannelSigner for TestChannelSigner {
286
+ fn generate_local_nonce_pair ( & self , commitment_number : u64 , secp_ctx : & Secp256k1 < All > ) -> PublicNonce {
287
+ todo ! ( )
288
+ }
289
+
290
+ fn partially_sign_counterparty_commitment ( & self , counterparty_nonce : PublicNonce , commitment_tx : & CommitmentTransaction , preimages : Vec < PaymentPreimage > , secp_ctx : & Secp256k1 < All > ) -> Result < ( PartialSignatureWithNonce , Vec < secp256k1:: schnorr:: Signature > ) , ( ) > {
291
+ todo ! ( )
292
+ }
293
+
294
+ fn finalize_holder_commitment ( & self , commitment_number : u64 , commitment_tx : & HolderCommitmentTransaction , counterparty_partial_signature : PartialSignatureWithNonce , secp_ctx : & Secp256k1 < All > ) -> Result < PartialSignature , ( ) > {
295
+ todo ! ( )
296
+ }
297
+
298
+ 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 , ( ) > {
299
+ todo ! ( )
300
+ }
301
+
302
+ 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 , ( ) > {
303
+ todo ! ( )
304
+ }
305
+
306
+ fn sign_holder_htlc_transaction ( & self , htlc_tx : & Transaction , input : usize , htlc_descriptor : & HTLCDescriptor , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
307
+ todo ! ( )
308
+ }
309
+
310
+ 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 , ( ) > {
311
+ todo ! ( )
312
+ }
313
+
314
+ fn partially_sign_closing_transaction ( & self , closing_tx : & ClosingTransaction , secp_ctx : & Secp256k1 < All > ) -> Result < PartialSignature , ( ) > {
315
+ todo ! ( )
316
+ }
317
+
318
+ fn sign_holder_anchor_input ( & self , anchor_tx : & Transaction , input : usize , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
319
+ todo ! ( )
320
+ }
321
+ }
322
+
276
323
impl Writeable for TestChannelSigner {
277
324
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , Error > {
278
325
// TestChannelSigner has two fields - `inner` ([`InMemorySigner`]) and `state`
0 commit comments