@@ -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
@@ -109,9 +109,9 @@ impl TestChainMonitor {
109109 }
110110}
111111impl chain:: Watch for TestChainMonitor {
112- type Keys = EnforcingChannelKeys ;
112+ type ChanSigner = EnforcingSigner ;
113113
114- fn watch_channel ( & self , funding_txo : OutPoint , monitor : channelmonitor:: ChannelMonitor < EnforcingChannelKeys > ) -> Result < ( ) , channelmonitor:: ChannelMonitorUpdateErr > {
114+ fn watch_channel ( & self , funding_txo : OutPoint , monitor : channelmonitor:: ChannelMonitor < EnforcingSigner > ) -> Result < ( ) , channelmonitor:: ChannelMonitorUpdateErr > {
115115 let mut ser = VecWriter ( Vec :: new ( ) ) ;
116116 monitor. write ( & mut ser) . unwrap ( ) ;
117117 if let Some ( _) = self . latest_monitors . lock ( ) . unwrap ( ) . insert ( funding_txo, ( monitor. get_latest_update_id ( ) , ser. 0 ) ) {
@@ -128,7 +128,7 @@ impl chain::Watch for TestChainMonitor {
128128 hash_map:: Entry :: Occupied ( entry) => entry,
129129 hash_map:: Entry :: Vacant ( _) => panic ! ( "Didn't have monitor on update call" ) ,
130130 } ;
131- let mut deserialized_monitor = <( BlockHash , channelmonitor:: ChannelMonitor < EnforcingChannelKeys > ) >::
131+ let mut deserialized_monitor = <( BlockHash , channelmonitor:: ChannelMonitor < EnforcingSigner > ) >::
132132 read ( & mut Cursor :: new ( & map_entry. get ( ) . 1 ) , & OnlyReadsKeysInterface { } ) . unwrap ( ) . 1 ;
133133 deserialized_monitor. update_monitor ( & update, & & TestBroadcaster { } , & & FuzzEstimator { } , & self . logger ) . unwrap ( ) ;
134134 let mut ser = VecWriter ( Vec :: new ( ) ) ;
@@ -149,7 +149,7 @@ struct KeyProvider {
149149 revoked_commitments : Mutex < HashMap < [ u8 ; 32 ] , Arc < Mutex < u64 > > > > ,
150150}
151151impl KeysInterface for KeyProvider {
152- type ChanKeySigner = EnforcingChannelKeys ;
152+ type Signer = EnforcingSigner ;
153153
154154 fn get_node_secret ( & self ) -> SecretKey {
155155 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 +167,10 @@ impl KeysInterface for KeyProvider {
167167 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 ( ) )
168168 }
169169
170- fn get_channel_keys ( & self , _inbound : bool , channel_value_satoshis : u64 ) -> EnforcingChannelKeys {
170+ fn get_channel_signer ( & self , _inbound : bool , channel_value_satoshis : u64 ) -> EnforcingSigner {
171171 let secp_ctx = Secp256k1 :: signing_only ( ) ;
172172 let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
173- let keys = InMemoryChannelKeys :: new (
173+ let keys = InMemorySigner :: new (
174174 & secp_ctx,
175175 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 ( ) ,
176176 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 +182,23 @@ impl KeysInterface for KeyProvider {
182182 [ 0 ; 32 ] ,
183183 ) ;
184184 let revoked_commitment = self . make_revoked_commitment_cell ( keys. commitment_seed ) ;
185- EnforcingChannelKeys :: new_with_revoked ( keys, revoked_commitment, false )
185+ EnforcingSigner :: new_with_revoked ( keys, revoked_commitment, false )
186186 }
187187
188188 fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
189189 let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
190190 [ 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 ]
191191 }
192192
193- fn read_chan_signer ( & self , buffer : & [ u8 ] ) -> Result < Self :: ChanKeySigner , DecodeError > {
193+ fn read_chan_signer ( & self , buffer : & [ u8 ] ) -> Result < Self :: Signer , DecodeError > {
194194 let mut reader = std:: io:: Cursor :: new ( buffer) ;
195195
196- let inner: InMemoryChannelKeys = Readable :: read ( & mut reader) ?;
196+ let inner: InMemorySigner = Readable :: read ( & mut reader) ?;
197197 let revoked_commitment = self . make_revoked_commitment_cell ( inner. commitment_seed ) ;
198198
199199 let last_commitment_number = Readable :: read ( & mut reader) ?;
200200
201- Ok ( EnforcingChannelKeys {
201+ Ok ( EnforcingSigner {
202202 inner,
203203 last_commitment_number : Arc :: new ( Mutex :: new ( last_commitment_number) ) ,
204204 revoked_commitment,
@@ -259,7 +259,7 @@ fn check_payment_err(send_err: PaymentSendFailure) {
259259 }
260260}
261261
262- type ChanMan = ChannelManager < EnforcingChannelKeys , Arc < TestChainMonitor > , Arc < TestBroadcaster > , Arc < KeyProvider > , Arc < FuzzEstimator > , Arc < dyn Logger > > ;
262+ type ChanMan = ChannelManager < EnforcingSigner , Arc < TestChainMonitor > , Arc < TestBroadcaster > , Arc < KeyProvider > , Arc < FuzzEstimator > , Arc < dyn Logger > > ;
263263
264264#[ inline]
265265fn send_payment ( source : & ChanMan , dest : & ChanMan , dest_chan_id : u64 , amt : u64 , payment_id : & mut u8 ) -> bool {
@@ -339,7 +339,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
339339 let mut monitors = HashMap :: new( ) ;
340340 let mut old_monitors = $old_monitors. latest_monitors. lock( ) . unwrap( ) ;
341341 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 ) ;
342+ monitors. insert( outpoint, <( BlockHash , ChannelMonitor <EnforcingSigner >) >:: read( & mut Cursor :: new( & monitor_ser) , & OnlyReadsKeysInterface { } ) . expect( "Failed to read monitor" ) . 1 ) ;
343343 chain_monitor. latest_monitors. lock( ) . unwrap( ) . insert( outpoint, ( update_id, monitor_ser) ) ;
344344 }
345345 let mut monitor_refs = HashMap :: new( ) ;
0 commit comments