@@ -709,10 +709,7 @@ impl HTLCDescriptor {
709
709
where
710
710
SP :: Target : SignerProvider < EcdsaSigner = S > ,
711
711
{
712
- signer_provider. derive_channel_signer (
713
- self . channel_derivation_parameters . value_satoshis ,
714
- self . channel_derivation_parameters . keys_id ,
715
- )
712
+ signer_provider. derive_channel_signer ( self . channel_derivation_parameters . keys_id )
716
713
}
717
714
}
718
715
@@ -949,19 +946,15 @@ pub trait SignerProvider {
949
946
/// `channel_keys_id`.
950
947
///
951
948
/// This method must return a different value each time it is called.
952
- fn generate_channel_keys_id (
953
- & self , inbound : bool , channel_value_satoshis : u64 , user_channel_id : u128 ,
954
- ) -> [ u8 ; 32 ] ;
949
+ fn generate_channel_keys_id ( & self , inbound : bool , user_channel_id : u128 ) -> [ u8 ; 32 ] ;
955
950
956
951
/// Derives the private key material backing a `Signer`.
957
952
///
958
953
/// To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through
959
954
/// [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be
960
955
/// re-derived from its `channel_keys_id`, which can be obtained through its trait method
961
956
/// [`ChannelSigner::channel_keys_id`].
962
- fn derive_channel_signer (
963
- & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ,
964
- ) -> Self :: EcdsaSigner ;
957
+ fn derive_channel_signer ( & self , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner ;
965
958
966
959
/// Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
967
960
///
@@ -1014,8 +1007,6 @@ pub struct InMemorySigner {
1014
1007
pub commitment_seed : [ u8 ; 32 ] ,
1015
1008
/// Holder public keys and basepoints.
1016
1009
pub ( crate ) holder_channel_pubkeys : ChannelPublicKeys ,
1017
- /// The total value of this channel.
1018
- channel_value_satoshis : u64 ,
1019
1010
/// Key derivation parameters.
1020
1011
channel_keys_id : [ u8 ; 32 ] ,
1021
1012
/// A source of random bytes.
@@ -1031,7 +1022,6 @@ impl PartialEq for InMemorySigner {
1031
1022
&& self . htlc_base_key == other. htlc_base_key
1032
1023
&& self . commitment_seed == other. commitment_seed
1033
1024
&& self . holder_channel_pubkeys == other. holder_channel_pubkeys
1034
- && self . channel_value_satoshis == other. channel_value_satoshis
1035
1025
&& self . channel_keys_id == other. channel_keys_id
1036
1026
}
1037
1027
}
@@ -1046,7 +1036,6 @@ impl Clone for InMemorySigner {
1046
1036
htlc_base_key : self . htlc_base_key . clone ( ) ,
1047
1037
commitment_seed : self . commitment_seed . clone ( ) ,
1048
1038
holder_channel_pubkeys : self . holder_channel_pubkeys . clone ( ) ,
1049
- channel_value_satoshis : self . channel_value_satoshis ,
1050
1039
channel_keys_id : self . channel_keys_id ,
1051
1040
entropy_source : RandomBytes :: new ( self . get_secure_random_bytes ( ) ) ,
1052
1041
}
@@ -1058,8 +1047,7 @@ impl InMemorySigner {
1058
1047
pub fn new < C : Signing > (
1059
1048
secp_ctx : & Secp256k1 < C > , funding_key : SecretKey , revocation_base_key : SecretKey ,
1060
1049
payment_key : SecretKey , delayed_payment_base_key : SecretKey , htlc_base_key : SecretKey ,
1061
- commitment_seed : [ u8 ; 32 ] , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ,
1062
- rand_bytes_unique_start : [ u8 ; 32 ] ,
1050
+ commitment_seed : [ u8 ; 32 ] , channel_keys_id : [ u8 ; 32 ] , rand_bytes_unique_start : [ u8 ; 32 ] ,
1063
1051
) -> InMemorySigner {
1064
1052
let holder_channel_pubkeys = InMemorySigner :: make_holder_keys (
1065
1053
secp_ctx,
@@ -1076,7 +1064,6 @@ impl InMemorySigner {
1076
1064
delayed_payment_base_key,
1077
1065
htlc_base_key,
1078
1066
commitment_seed,
1079
- channel_value_satoshis,
1080
1067
holder_channel_pubkeys,
1081
1068
channel_keys_id,
1082
1069
entropy_source : RandomBytes :: new ( rand_bytes_unique_start) ,
@@ -1831,9 +1818,7 @@ impl KeysManager {
1831
1818
}
1832
1819
1833
1820
/// Derive an old [`EcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters.
1834
- pub fn derive_channel_keys (
1835
- & self , channel_value_satoshis : u64 , params : & [ u8 ; 32 ] ,
1836
- ) -> InMemorySigner {
1821
+ pub fn derive_channel_keys ( & self , params : & [ u8 ; 32 ] ) -> InMemorySigner {
1837
1822
let chan_id = u64:: from_be_bytes ( params[ 0 ..8 ] . try_into ( ) . unwrap ( ) ) ;
1838
1823
let mut unique_start = Sha256 :: engine ( ) ;
1839
1824
unique_start. input ( params) ;
@@ -1885,7 +1870,6 @@ impl KeysManager {
1885
1870
delayed_payment_base_key,
1886
1871
htlc_base_key,
1887
1872
commitment_seed,
1888
- channel_value_satoshis,
1889
1873
params. clone ( ) ,
1890
1874
prng_seed,
1891
1875
)
@@ -1917,10 +1901,7 @@ impl KeysManager {
1917
1901
if keys_cache. is_none ( )
1918
1902
|| keys_cache. as_ref ( ) . unwrap ( ) . 1 != descriptor. channel_keys_id
1919
1903
{
1920
- let signer = self . derive_channel_keys (
1921
- descriptor. channel_value_satoshis ,
1922
- & descriptor. channel_keys_id ,
1923
- ) ;
1904
+ let signer = self . derive_channel_keys ( & descriptor. channel_keys_id ) ;
1924
1905
keys_cache = Some ( ( signer, descriptor. channel_keys_id ) ) ;
1925
1906
}
1926
1907
let witness = keys_cache. as_ref ( ) . unwrap ( ) . 0 . sign_counterparty_payment_input (
@@ -1937,10 +1918,7 @@ impl KeysManager {
1937
1918
|| keys_cache. as_ref ( ) . unwrap ( ) . 1 != descriptor. channel_keys_id
1938
1919
{
1939
1920
keys_cache = Some ( (
1940
- self . derive_channel_keys (
1941
- descriptor. channel_value_satoshis ,
1942
- & descriptor. channel_keys_id ,
1943
- ) ,
1921
+ self . derive_channel_keys ( & descriptor. channel_keys_id ) ,
1944
1922
descriptor. channel_keys_id ,
1945
1923
) ) ;
1946
1924
}
@@ -2109,9 +2087,7 @@ impl SignerProvider for KeysManager {
2109
2087
#[ cfg( taproot) ]
2110
2088
type TaprootSigner = InMemorySigner ;
2111
2089
2112
- fn generate_channel_keys_id (
2113
- & self , _inbound : bool , _channel_value_satoshis : u64 , user_channel_id : u128 ,
2114
- ) -> [ u8 ; 32 ] {
2090
+ fn generate_channel_keys_id ( & self , _inbound : bool , user_channel_id : u128 ) -> [ u8 ; 32 ] {
2115
2091
let child_idx = self . channel_child_index . fetch_add ( 1 , Ordering :: AcqRel ) ;
2116
2092
// `child_idx` is the only thing guaranteed to make each channel unique without a restart
2117
2093
// (though `user_channel_id` should help, depending on user behavior). If it manages to
@@ -2127,10 +2103,8 @@ impl SignerProvider for KeysManager {
2127
2103
id
2128
2104
}
2129
2105
2130
- fn derive_channel_signer (
2131
- & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ,
2132
- ) -> Self :: EcdsaSigner {
2133
- self . derive_channel_keys ( channel_value_satoshis, & channel_keys_id)
2106
+ fn derive_channel_signer ( & self , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner {
2107
+ self . derive_channel_keys ( & channel_keys_id)
2134
2108
}
2135
2109
2136
2110
fn get_destination_script ( & self , _channel_keys_id : [ u8 ; 32 ] ) -> Result < ScriptBuf , ( ) > {
@@ -2250,16 +2224,12 @@ impl SignerProvider for PhantomKeysManager {
2250
2224
#[ cfg( taproot) ]
2251
2225
type TaprootSigner = InMemorySigner ;
2252
2226
2253
- fn generate_channel_keys_id (
2254
- & self , inbound : bool , channel_value_satoshis : u64 , user_channel_id : u128 ,
2255
- ) -> [ u8 ; 32 ] {
2256
- self . inner . generate_channel_keys_id ( inbound, channel_value_satoshis, user_channel_id)
2227
+ fn generate_channel_keys_id ( & self , inbound : bool , user_channel_id : u128 ) -> [ u8 ; 32 ] {
2228
+ self . inner . generate_channel_keys_id ( inbound, user_channel_id)
2257
2229
}
2258
2230
2259
- fn derive_channel_signer (
2260
- & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ,
2261
- ) -> Self :: EcdsaSigner {
2262
- self . inner . derive_channel_signer ( channel_value_satoshis, channel_keys_id)
2231
+ fn derive_channel_signer ( & self , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner {
2232
+ self . inner . derive_channel_signer ( channel_keys_id)
2263
2233
}
2264
2234
2265
2235
fn get_destination_script ( & self , channel_keys_id : [ u8 ; 32 ] ) -> Result < ScriptBuf , ( ) > {
@@ -2303,10 +2273,8 @@ impl PhantomKeysManager {
2303
2273
}
2304
2274
2305
2275
/// See [`KeysManager::derive_channel_keys`] for documentation on this method.
2306
- pub fn derive_channel_keys (
2307
- & self , channel_value_satoshis : u64 , params : & [ u8 ; 32 ] ,
2308
- ) -> InMemorySigner {
2309
- self . inner . derive_channel_keys ( channel_value_satoshis, params)
2276
+ pub fn derive_channel_keys ( & self , params : & [ u8 ; 32 ] ) -> InMemorySigner {
2277
+ self . inner . derive_channel_keys ( params)
2310
2278
}
2311
2279
2312
2280
/// Gets the "node_id" secret key used to sign gossip announcements, decode onion data, etc.
0 commit comments