@@ -31,7 +31,6 @@ use bitcoin::hashes::{Hash, HashEngine};
31
31
use bitcoin:: secp256k1:: ecdh:: SharedSecret ;
32
32
use bitcoin:: secp256k1:: ecdsa:: { RecoverableSignature , Signature } ;
33
33
use bitcoin:: secp256k1:: schnorr;
34
- #[ cfg( taproot) ]
35
34
use bitcoin:: secp256k1:: All ;
36
35
use bitcoin:: secp256k1:: { Keypair , PublicKey , Scalar , Secp256k1 , SecretKey , Signing } ;
37
36
use bitcoin:: { secp256k1, Psbt , Sequence , Txid , WPubkeyHash , Witness } ;
@@ -704,6 +703,13 @@ impl HTLCDescriptor {
704
703
}
705
704
}
706
705
706
+ /// Extension trait for [`ChannelSigner`] providing access to additional channel-specific
707
+ /// details. In particular, this is useful for functional tests.
708
+ pub trait ChannelSignerExt : ChannelSigner {
709
+ /// Returns the commitment seed for the channel.
710
+ fn commitment_seed ( & self ) -> [ u8 ; 32 ] ;
711
+ }
712
+
707
713
/// A trait to handle Lightning channel key material without concretizing the channel type or
708
714
/// the signature mechanism.
709
715
///
@@ -898,10 +904,10 @@ pub trait OutputSpender {
898
904
/// Returns `Err(())` if the output value is greater than the input value minus required fee,
899
905
/// if a descriptor was duplicated, or if an output descriptor `script_pubkey`
900
906
/// does not match the one we can spend.
901
- fn spend_spendable_outputs < C : Signing > (
907
+ fn spend_spendable_outputs (
902
908
& self , descriptors : & [ & SpendableOutputDescriptor ] , outputs : Vec < TxOut > ,
903
909
change_destination_script : ScriptBuf , feerate_sat_per_1000_weight : u32 ,
904
- locktime : Option < LockTime > , secp_ctx : & Secp256k1 < C > ,
910
+ locktime : Option < LockTime > , secp_ctx : & Secp256k1 < All > ,
905
911
) -> Result < Transaction , ( ) > ;
906
912
}
907
913
@@ -1227,6 +1233,12 @@ impl EntropySource for InMemorySigner {
1227
1233
}
1228
1234
}
1229
1235
1236
+ impl ChannelSignerExt for InMemorySigner {
1237
+ fn commitment_seed ( & self ) -> [ u8 ; 32 ] {
1238
+ self . commitment_seed
1239
+ }
1240
+ }
1241
+
1230
1242
impl ChannelSigner for InMemorySigner {
1231
1243
fn get_per_commitment_point (
1232
1244
& self , idx : u64 , secp_ctx : & Secp256k1 < secp256k1:: All > ,
@@ -1351,7 +1363,7 @@ impl EcdsaChannelSigner for InMemorySigner {
1351
1363
) )
1352
1364
}
1353
1365
1354
- #[ cfg( any( test, feature = "unsafe_revoked_tx_signing" ) ) ]
1366
+ #[ cfg( any( test, feature = "_test_utils" , feature = " unsafe_revoked_tx_signing") ) ]
1355
1367
fn unsafe_sign_holder_commitment (
1356
1368
& self , channel_parameters : & ChannelTransactionParameters ,
1357
1369
commitment_tx : & HolderCommitmentTransaction , secp_ctx : & Secp256k1 < secp256k1:: All > ,
@@ -2044,10 +2056,10 @@ impl OutputSpender for KeysManager {
2044
2056
///
2045
2057
/// May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used
2046
2058
/// this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`].
2047
- fn spend_spendable_outputs < C : Signing > (
2059
+ fn spend_spendable_outputs (
2048
2060
& self , descriptors : & [ & SpendableOutputDescriptor ] , outputs : Vec < TxOut > ,
2049
2061
change_destination_script : ScriptBuf , feerate_sat_per_1000_weight : u32 ,
2050
- locktime : Option < LockTime > , secp_ctx : & Secp256k1 < C > ,
2062
+ locktime : Option < LockTime > , secp_ctx : & Secp256k1 < All > ,
2051
2063
) -> Result < Transaction , ( ) > {
2052
2064
let ( mut psbt, expected_max_weight) =
2053
2065
SpendableOutputDescriptor :: create_spendable_outputs_psbt (
@@ -2194,10 +2206,10 @@ impl NodeSigner for PhantomKeysManager {
2194
2206
impl OutputSpender for PhantomKeysManager {
2195
2207
/// See [`OutputSpender::spend_spendable_outputs`] and [`KeysManager::spend_spendable_outputs`]
2196
2208
/// for documentation on this method.
2197
- fn spend_spendable_outputs < C : Signing > (
2209
+ fn spend_spendable_outputs (
2198
2210
& self , descriptors : & [ & SpendableOutputDescriptor ] , outputs : Vec < TxOut > ,
2199
2211
change_destination_script : ScriptBuf , feerate_sat_per_1000_weight : u32 ,
2200
- locktime : Option < LockTime > , secp_ctx : & Secp256k1 < C > ,
2212
+ locktime : Option < LockTime > , secp_ctx : & Secp256k1 < All > ,
2201
2213
) -> Result < Transaction , ( ) > {
2202
2214
self . inner . spend_spendable_outputs (
2203
2215
descriptors,
0 commit comments