@@ -34,11 +34,11 @@ use lightning::chain::channelmonitor;
3434use lightning:: chain:: channelmonitor:: { ChannelMonitor , ChannelMonitorUpdateErr , MonitorEvent } ;
3535use lightning:: chain:: transaction:: OutPoint ;
3636use lightning:: chain:: chaininterface:: { BroadcasterInterface , ConfirmationTarget , FeeEstimator } ;
37- use lightning:: chain:: keysinterface:: { KeysInterface , InMemoryChannelKeys } ;
37+ use lightning:: chain:: keysinterface:: { KeysInterface , InMemorySigner } ;
3838use lightning:: ln:: channelmanager:: { ChannelManager , PaymentHash , PaymentPreimage , PaymentSecret , PaymentSendFailure , ChannelManagerReadArgs } ;
3939use lightning:: ln:: features:: { ChannelFeatures , InitFeatures , NodeFeatures } ;
4040use lightning:: ln:: msgs:: { CommitmentUpdate , ChannelMessageHandler , DecodeError , ErrorAction , UpdateAddHTLC , Init } ;
41- use lightning:: util:: enforcing_trait_impls:: { EnforcingChannelKeys , INITIAL_REVOKED_COMMITMENT_NUMBER } ;
41+ use lightning:: util:: enforcing_trait_impls:: { EnforcingSigner , INITIAL_REVOKED_COMMITMENT_NUMBER } ;
4242use lightning:: util:: errors:: APIError ;
4343use lightning:: util:: events;
4444use lightning:: util:: logger:: Logger ;
@@ -87,7 +87,7 @@ impl Writer for VecWriter {
8787
8888struct TestChainMonitor {
8989 pub logger : Arc < dyn Logger > ,
90- pub chain_monitor : Arc < chainmonitor:: ChainMonitor < EnforcingChannelKeys , Arc < dyn chain:: Filter > , Arc < TestBroadcaster > , Arc < FuzzEstimator > , Arc < dyn Logger > , Arc < TestPersister > > > ,
90+ pub chain_monitor : Arc < chainmonitor:: ChainMonitor < EnforcingSigner , Arc < dyn chain:: Filter > , Arc < TestBroadcaster > , Arc < FuzzEstimator > , Arc < dyn Logger > , Arc < TestPersister > > > ,
9191 pub update_ret : Mutex < Result < ( ) , channelmonitor:: ChannelMonitorUpdateErr > > ,
9292 // If we reload a node with an old copy of ChannelMonitors, the ChannelManager deserialization
9393 // logic will automatically force-close our channels for us (as we don't have an up-to-date
@@ -108,10 +108,8 @@ impl TestChainMonitor {
108108 }
109109 }
110110}
111- impl chain:: Watch for TestChainMonitor {
112- type Keys = EnforcingChannelKeys ;
113-
114- fn watch_channel ( & self , funding_txo : OutPoint , monitor : channelmonitor:: ChannelMonitor < EnforcingChannelKeys > ) -> Result < ( ) , channelmonitor:: ChannelMonitorUpdateErr > {
111+ impl chain:: Watch < EnforcingSigner > for TestChainMonitor {
112+ fn watch_channel ( & self , funding_txo : OutPoint , monitor : channelmonitor:: ChannelMonitor < EnforcingSigner > ) -> Result < ( ) , channelmonitor:: ChannelMonitorUpdateErr > {
115113 let mut ser = VecWriter ( Vec :: new ( ) ) ;
116114 monitor. write ( & mut ser) . unwrap ( ) ;
117115 if let Some ( _) = self . latest_monitors . lock ( ) . unwrap ( ) . insert ( funding_txo, ( monitor. get_latest_update_id ( ) , ser. 0 ) ) {
@@ -128,7 +126,7 @@ impl chain::Watch for TestChainMonitor {
128126 hash_map:: Entry :: Occupied ( entry) => entry,
129127 hash_map:: Entry :: Vacant ( _) => panic ! ( "Didn't have monitor on update call" ) ,
130128 } ;
131- let mut deserialized_monitor = <( BlockHash , channelmonitor:: ChannelMonitor < EnforcingChannelKeys > ) >::
129+ let mut deserialized_monitor = <( BlockHash , channelmonitor:: ChannelMonitor < EnforcingSigner > ) >::
132130 read ( & mut Cursor :: new ( & map_entry. get ( ) . 1 ) , & OnlyReadsKeysInterface { } ) . unwrap ( ) . 1 ;
133131 deserialized_monitor. update_monitor ( & update, & & TestBroadcaster { } , & & FuzzEstimator { } , & self . logger ) . unwrap ( ) ;
134132 let mut ser = VecWriter ( Vec :: new ( ) ) ;
@@ -149,7 +147,7 @@ struct KeyProvider {
149147 revoked_commitments : Mutex < HashMap < [ u8 ; 32 ] , Arc < Mutex < u64 > > > > ,
150148}
151149impl KeysInterface for KeyProvider {
152- type ChanKeySigner = EnforcingChannelKeys ;
150+ type Signer = EnforcingSigner ;
153151
154152 fn get_node_secret ( & self ) -> SecretKey {
155153 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 ( )
@@ -167,10 +165,10 @@ impl KeysInterface for KeyProvider {
167165 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 ( ) )
168166 }
169167
170- fn get_channel_keys ( & self , _inbound : bool , channel_value_satoshis : u64 ) -> EnforcingChannelKeys {
168+ fn get_channel_signer ( & self , _inbound : bool , channel_value_satoshis : u64 ) -> EnforcingSigner {
171169 let secp_ctx = Secp256k1 :: signing_only ( ) ;
172170 let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
173- let keys = InMemoryChannelKeys :: new (
171+ let keys = InMemorySigner :: new (
174172 & secp_ctx,
175173 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 ( ) ,
176174 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 ( ) ,
@@ -182,23 +180,23 @@ impl KeysInterface for KeyProvider {
182180 [ 0 ; 32 ] ,
183181 ) ;
184182 let revoked_commitment = self . make_revoked_commitment_cell ( keys. commitment_seed ) ;
185- EnforcingChannelKeys :: new_with_revoked ( keys, revoked_commitment, false )
183+ EnforcingSigner :: new_with_revoked ( keys, revoked_commitment, false )
186184 }
187185
188186 fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
189187 let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
190188 [ 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 , id, 11 , self . node_id ]
191189 }
192190
193- fn read_chan_signer ( & self , buffer : & [ u8 ] ) -> Result < Self :: ChanKeySigner , DecodeError > {
191+ fn read_chan_signer ( & self , buffer : & [ u8 ] ) -> Result < Self :: Signer , DecodeError > {
194192 let mut reader = std:: io:: Cursor :: new ( buffer) ;
195193
196- let inner: InMemoryChannelKeys = Readable :: read ( & mut reader) ?;
194+ let inner: InMemorySigner = Readable :: read ( & mut reader) ?;
197195 let revoked_commitment = self . make_revoked_commitment_cell ( inner. commitment_seed ) ;
198196
199197 let last_commitment_number = Readable :: read ( & mut reader) ?;
200198
201- Ok ( EnforcingChannelKeys {
199+ Ok ( EnforcingSigner {
202200 inner,
203201 last_commitment_number : Arc :: new ( Mutex :: new ( last_commitment_number) ) ,
204202 revoked_commitment,
@@ -259,7 +257,7 @@ fn check_payment_err(send_err: PaymentSendFailure) {
259257 }
260258}
261259
262- type ChanMan = ChannelManager < EnforcingChannelKeys , Arc < TestChainMonitor > , Arc < TestBroadcaster > , Arc < KeyProvider > , Arc < FuzzEstimator > , Arc < dyn Logger > > ;
260+ type ChanMan = ChannelManager < EnforcingSigner , Arc < TestChainMonitor > , Arc < TestBroadcaster > , Arc < KeyProvider > , Arc < FuzzEstimator > , Arc < dyn Logger > > ;
263261
264262#[ inline]
265263fn send_payment ( source : & ChanMan , dest : & ChanMan , dest_chan_id : u64 , amt : u64 , payment_id : & mut u8 ) -> bool {
@@ -339,7 +337,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
339337 let mut monitors = HashMap :: new( ) ;
340338 let mut old_monitors = $old_monitors. latest_monitors. lock( ) . unwrap( ) ;
341339 for ( outpoint, ( update_id, monitor_ser) ) in old_monitors. drain( ) {
342- monitors. insert( outpoint, <( BlockHash , ChannelMonitor <EnforcingChannelKeys >) >:: read( & mut Cursor :: new( & monitor_ser) , & OnlyReadsKeysInterface { } ) . expect( "Failed to read monitor" ) . 1 ) ;
340+ monitors. insert( outpoint, <( BlockHash , ChannelMonitor <EnforcingSigner >) >:: read( & mut Cursor :: new( & monitor_ser) , & OnlyReadsKeysInterface { } ) . expect( "Failed to read monitor" ) . 1 ) ;
343341 chain_monitor. latest_monitors. lock( ) . unwrap( ) . insert( outpoint, ( update_id, monitor_ser) ) ;
344342 }
345343 let mut monitor_refs = HashMap :: new( ) ;
0 commit comments