@@ -24,12 +24,13 @@ use bitcoin_hashes::sha256d::Hash as Sha256d;
24
24
use lightning:: chain:: chaininterface;
25
25
use lightning:: chain:: transaction:: OutPoint ;
26
26
use lightning:: chain:: chaininterface:: { BroadcasterInterface , ConfirmationTarget , ChainListener , FeeEstimator , ChainWatchInterfaceUtil } ;
27
- use lightning:: chain:: keysinterface:: { InMemoryChannelKeys , KeysInterface } ;
27
+ use lightning:: chain:: keysinterface:: { KeysInterface , InMemoryChannelKeys } ;
28
28
use lightning:: ln:: channelmonitor;
29
29
use lightning:: ln:: channelmonitor:: { ChannelMonitor , ChannelMonitorUpdateErr , HTLCUpdate } ;
30
30
use lightning:: ln:: channelmanager:: { ChannelManager , PaymentHash , PaymentPreimage , ChannelManagerReadArgs } ;
31
31
use lightning:: ln:: router:: { Route , RouteHop } ;
32
32
use lightning:: ln:: msgs:: { CommitmentUpdate , ChannelMessageHandler , ErrorAction , LightningError , UpdateAddHTLC , LocalFeatures } ;
33
+ use lightning:: util:: enforcing_trait_impls:: EnforcingChannelKeys ;
33
34
use lightning:: util:: events;
34
35
use lightning:: util:: logger:: Logger ;
35
36
use lightning:: util:: config:: UserConfig ;
@@ -130,7 +131,7 @@ struct KeyProvider {
130
131
channel_id : atomic:: AtomicU8 ,
131
132
}
132
133
impl KeysInterface for KeyProvider {
133
- type ChanKeySigner = InMemoryChannelKeys ;
134
+ type ChanKeySigner = EnforcingChannelKeys ;
134
135
135
136
fn get_node_secret ( & self ) -> SecretKey {
136
137
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 ( )
@@ -148,15 +149,15 @@ impl KeysInterface for KeyProvider {
148
149
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 ( ) )
149
150
}
150
151
151
- fn get_channel_keys ( & self , _inbound : bool ) -> InMemoryChannelKeys {
152
- InMemoryChannelKeys {
152
+ fn get_channel_keys ( & self , _inbound : bool ) -> EnforcingChannelKeys {
153
+ EnforcingChannelKeys :: new ( InMemoryChannelKeys {
153
154
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 ( ) ,
154
155
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 ( ) ,
155
156
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 ( ) ,
156
157
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 ( ) ,
157
158
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 ( ) ,
158
159
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 ] ,
159
- }
160
+ } )
160
161
}
161
162
162
163
fn get_onion_rand ( & self ) -> ( SecretKey , [ u8 ; 32 ] ) {
@@ -225,7 +226,7 @@ pub fn do_test(data: &[u8]) {
225
226
channel_monitors: & monitor_refs,
226
227
} ;
227
228
228
- let res = ( <( Sha256d , ChannelManager <InMemoryChannelKeys >) >:: read( & mut Cursor :: new( & $ser. 0 ) , read_args) . expect( "Failed to read manager" ) . 1 , monitor) ;
229
+ let res = ( <( Sha256d , ChannelManager <EnforcingChannelKeys >) >:: read( & mut Cursor :: new( & $ser. 0 ) , read_args) . expect( "Failed to read manager" ) . 1 , monitor) ;
229
230
for ( _, was_good) in $old_monitors. latest_updates_good_at_last_ser. lock( ) . unwrap( ) . iter( ) {
230
231
if !was_good {
231
232
// If the last time we updated a monitor we didn't successfully update (and we
0 commit comments