@@ -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 :: 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 :: 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 (
@@ -211,11 +219,11 @@ impl EcdsaChannelSigner for TestChannelSigner {
211
219
) -> Result < Signature , ( ) > {
212
220
assert_eq ! ( htlc_tx. input[ input] , htlc_descriptor. unsigned_tx_input( ) ) ;
213
221
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 ( ) )
222
+ Ok ( EcdsaChannelSigner :: sign_holder_htlc_transaction ( & self . inner , htlc_tx, input, htlc_descriptor, secp_ctx) . unwrap ( ) )
215
223
}
216
224
217
225
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 ( ) )
226
+ Ok ( EcdsaChannelSigner :: sign_counterparty_htlc_transaction ( & self . inner , htlc_tx, input, amount, per_commitment_point, htlc, secp_ctx) . unwrap ( ) )
219
227
}
220
228
221
229
fn sign_closing_transaction ( & self , closing_tx : & ClosingTransaction , secp_ctx : & Secp256k1 < secp256k1:: All > ) -> Result < Signature , ( ) > {
@@ -231,7 +239,7 @@ impl EcdsaChannelSigner for TestChannelSigner {
231
239
// As long as our minimum dust limit is enforced and is greater than our anchor output
232
240
// value, an anchor output can only have an index within [0, 1].
233
241
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)
242
+ EcdsaChannelSigner :: sign_holder_anchor_input ( & self . inner , anchor_tx, input, secp_ctx)
235
243
}
236
244
237
245
fn sign_channel_announcement_with_funding_key (
@@ -243,6 +251,45 @@ impl EcdsaChannelSigner for TestChannelSigner {
243
251
244
252
impl WriteableEcdsaChannelSigner for TestChannelSigner { }
245
253
254
+ #[ cfg( taproot) ]
255
+ impl TaprootChannelSigner for TestChannelSigner {
256
+ fn generate_local_nonce_pair ( & self , commitment_number : u64 , secp_ctx : & Secp256k1 < All > ) -> PublicNonce {
257
+ todo ! ( )
258
+ }
259
+
260
+ 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 > ) , ( ) > {
261
+ todo ! ( )
262
+ }
263
+
264
+ fn finalize_holder_commitment_and_htlc_signatures ( & self , commitment_number : u64 , commitment_tx : & HolderCommitmentTransaction , counterparty_partial_signature : PartialSignatureWithNonce , secp_ctx : & Secp256k1 < All > ) -> Result < ( PartialSignature , Vec < secp256k1:: schnorr:: Signature > ) , ( ) > {
265
+ todo ! ( )
266
+ }
267
+
268
+ 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 , ( ) > {
269
+ todo ! ( )
270
+ }
271
+
272
+ 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 , ( ) > {
273
+ todo ! ( )
274
+ }
275
+
276
+ fn sign_holder_htlc_transaction ( & self , htlc_tx : & Transaction , input : usize , htlc_descriptor : & HTLCDescriptor , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
277
+ todo ! ( )
278
+ }
279
+
280
+ 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 , ( ) > {
281
+ todo ! ( )
282
+ }
283
+
284
+ fn partially_sign_closing_transaction ( & self , closing_tx : & ClosingTransaction , secp_ctx : & Secp256k1 < All > ) -> Result < PartialSignature , ( ) > {
285
+ todo ! ( )
286
+ }
287
+
288
+ fn sign_holder_anchor_input ( & self , anchor_tx : & Transaction , input : usize , secp_ctx : & Secp256k1 < All > ) -> Result < secp256k1:: schnorr:: Signature , ( ) > {
289
+ todo ! ( )
290
+ }
291
+ }
292
+
246
293
impl Writeable for TestChannelSigner {
247
294
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , Error > {
248
295
// TestChannelSigner has two fields - `inner` ([`InMemorySigner`]) and `state`
0 commit comments