@@ -32,12 +32,13 @@ use bitcoin_hashes::sha256d::Hash as Sha256d;
32
32
use lightning:: chain:: chaininterface;
33
33
use lightning:: chain:: transaction:: OutPoint ;
34
34
use lightning:: chain:: chaininterface:: { BroadcasterInterface , ConfirmationTarget , ChainListener , FeeEstimator , ChainWatchInterfaceUtil } ;
35
- use lightning:: chain:: keysinterface:: { InMemoryChannelKeys , KeysInterface } ;
35
+ use lightning:: chain:: keysinterface:: { KeysInterface , InMemoryChannelKeys } ;
36
36
use lightning:: ln:: channelmonitor;
37
37
use lightning:: ln:: channelmonitor:: { ChannelMonitor , ChannelMonitorUpdateErr , HTLCUpdate } ;
38
38
use lightning:: ln:: channelmanager:: { ChannelManager , PaymentHash , PaymentPreimage , ChannelManagerReadArgs } ;
39
39
use lightning:: ln:: router:: { Route , RouteHop } ;
40
40
use lightning:: ln:: msgs:: { CommitmentUpdate , ChannelMessageHandler , ErrorAction , LightningError , UpdateAddHTLC , LocalFeatures } ;
41
+ use lightning:: util:: enforcing_trait_impls:: EnforcingChannelKeys ;
41
42
use lightning:: util:: events;
42
43
use lightning:: util:: logger:: Logger ;
43
44
use lightning:: util:: config:: UserConfig ;
@@ -139,7 +140,7 @@ struct KeyProvider {
139
140
channel_id : atomic:: AtomicU8 ,
140
141
}
141
142
impl KeysInterface for KeyProvider {
142
- type ChanKeySigner = InMemoryChannelKeys ;
143
+ type ChanKeySigner = EnforcingChannelKeys ;
143
144
144
145
fn get_node_secret ( & self ) -> SecretKey {
145
146
SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , self . node_id ] ) . unwrap ( )
@@ -157,15 +158,15 @@ impl KeysInterface for KeyProvider {
157
158
PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , self . node_id ] ) . unwrap ( ) )
158
159
}
159
160
160
- fn get_channel_keys ( & self , _inbound : bool ) -> InMemoryChannelKeys {
161
- InMemoryChannelKeys {
161
+ fn get_channel_keys ( & self , _inbound : bool ) -> EnforcingChannelKeys {
162
+ EnforcingChannelKeys :: new ( InMemoryChannelKeys {
162
163
funding_key : SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , self . node_id ] ) . unwrap ( ) ,
163
164
revocation_base_key : SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 5 , self . node_id ] ) . unwrap ( ) ,
164
165
payment_base_key : SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 6 , self . node_id ] ) . unwrap ( ) ,
165
166
delayed_payment_base_key : SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 7 , self . node_id ] ) . unwrap ( ) ,
166
167
htlc_base_key : SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 8 , self . node_id ] ) . unwrap ( ) ,
167
168
commitment_seed : [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 9 , self . node_id ] ,
168
- }
169
+ } )
169
170
}
170
171
171
172
fn get_onion_rand ( & self ) -> ( SecretKey , [ u8 ; 32 ] ) {
@@ -234,7 +235,7 @@ pub fn do_test(data: &[u8]) {
234
235
channel_monitors: & monitor_refs,
235
236
} ;
236
237
237
- let res = ( <( Sha256d , ChannelManager <InMemoryChannelKeys >) >:: read( & mut Cursor :: new( & $ser. 0 ) , read_args) . expect( "Failed to read manager" ) . 1 , monitor) ;
238
+ let res = ( <( Sha256d , ChannelManager <EnforcingChannelKeys >) >:: read( & mut Cursor :: new( & $ser. 0 ) , read_args) . expect( "Failed to read manager" ) . 1 , monitor) ;
238
239
for ( _, was_good) in $old_monitors. latest_updates_good_at_last_ser. lock( ) . unwrap( ) . iter( ) {
239
240
if !was_good {
240
241
// If the last time we updated a monitor we didn't successfully update (and we
0 commit comments