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