@@ -34,11 +34,11 @@ use lightning::chain::channelmonitor;
34
34
use lightning:: chain:: channelmonitor:: { ChannelMonitor , ChannelMonitorUpdateErr , MonitorEvent } ;
35
35
use lightning:: chain:: transaction:: OutPoint ;
36
36
use lightning:: chain:: chaininterface:: { BroadcasterInterface , ConfirmationTarget , FeeEstimator } ;
37
- use lightning:: chain:: keysinterface:: { KeysInterface , InMemoryChannelKeys } ;
37
+ use lightning:: chain:: keysinterface:: { KeysInterface , InMemorySigner } ;
38
38
use lightning:: ln:: channelmanager:: { ChannelManager , PaymentHash , PaymentPreimage , PaymentSecret , PaymentSendFailure , ChannelManagerReadArgs } ;
39
39
use lightning:: ln:: features:: { ChannelFeatures , InitFeatures , NodeFeatures } ;
40
40
use 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 } ;
42
42
use lightning:: util:: errors:: APIError ;
43
43
use lightning:: util:: events;
44
44
use lightning:: util:: logger:: Logger ;
@@ -87,7 +87,7 @@ impl Writer for VecWriter {
87
87
88
88
struct TestChainMonitor {
89
89
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 > > > ,
91
91
pub update_ret : Mutex < Result < ( ) , channelmonitor:: ChannelMonitorUpdateErr > > ,
92
92
// If we reload a node with an old copy of ChannelMonitors, the ChannelManager deserialization
93
93
// logic will automatically force-close our channels for us (as we don't have an up-to-date
@@ -109,9 +109,9 @@ impl TestChainMonitor {
109
109
}
110
110
}
111
111
impl chain:: Watch for TestChainMonitor {
112
- type Keys = EnforcingChannelKeys ;
112
+ type ChanSigner = EnforcingSigner ;
113
113
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 > {
115
115
let mut ser = VecWriter ( Vec :: new ( ) ) ;
116
116
monitor. write ( & mut ser) . unwrap ( ) ;
117
117
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 {
128
128
hash_map:: Entry :: Occupied ( entry) => entry,
129
129
hash_map:: Entry :: Vacant ( _) => panic ! ( "Didn't have monitor on update call" ) ,
130
130
} ;
131
- let mut deserialized_monitor = <( BlockHash , channelmonitor:: ChannelMonitor < EnforcingChannelKeys > ) >::
131
+ let mut deserialized_monitor = <( BlockHash , channelmonitor:: ChannelMonitor < EnforcingSigner > ) >::
132
132
read ( & mut Cursor :: new ( & map_entry. get ( ) . 1 ) , & OnlyReadsKeysInterface { } ) . unwrap ( ) . 1 ;
133
133
deserialized_monitor. update_monitor ( & update, & & TestBroadcaster { } , & & FuzzEstimator { } , & self . logger ) . unwrap ( ) ;
134
134
let mut ser = VecWriter ( Vec :: new ( ) ) ;
@@ -149,7 +149,7 @@ struct KeyProvider {
149
149
revoked_commitments : Mutex < HashMap < [ u8 ; 32 ] , Arc < Mutex < u64 > > > > ,
150
150
}
151
151
impl KeysInterface for KeyProvider {
152
- type ChanKeySigner = EnforcingChannelKeys ;
152
+ type Signer = EnforcingSigner ;
153
153
154
154
fn get_node_secret ( & self ) -> SecretKey {
155
155
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 {
167
167
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 ( ) )
168
168
}
169
169
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 {
171
171
let secp_ctx = Secp256k1 :: signing_only ( ) ;
172
172
let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
173
- let keys = InMemoryChannelKeys :: new (
173
+ let keys = InMemorySigner :: new (
174
174
& secp_ctx,
175
175
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 ( ) ,
176
176
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 {
182
182
[ 0 ; 32 ] ,
183
183
) ;
184
184
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 )
186
186
}
187
187
188
188
fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
189
189
let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
190
190
[ 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 ]
191
191
}
192
192
193
- fn read_chan_signer ( & self , buffer : & [ u8 ] ) -> Result < Self :: ChanKeySigner , DecodeError > {
193
+ fn read_chan_signer ( & self , buffer : & [ u8 ] ) -> Result < Self :: Signer , DecodeError > {
194
194
let mut reader = std:: io:: Cursor :: new ( buffer) ;
195
195
196
- let inner: InMemoryChannelKeys = Readable :: read ( & mut reader) ?;
196
+ let inner: InMemorySigner = Readable :: read ( & mut reader) ?;
197
197
let revoked_commitment = self . make_revoked_commitment_cell ( inner. commitment_seed ) ;
198
198
199
199
let last_commitment_number = Readable :: read ( & mut reader) ?;
200
200
201
- Ok ( EnforcingChannelKeys {
201
+ Ok ( EnforcingSigner {
202
202
inner,
203
203
last_commitment_number : Arc :: new ( Mutex :: new ( last_commitment_number) ) ,
204
204
revoked_commitment,
@@ -259,7 +259,7 @@ fn check_payment_err(send_err: PaymentSendFailure) {
259
259
}
260
260
}
261
261
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 > > ;
263
263
264
264
#[ inline]
265
265
fn 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) {
339
339
let mut monitors = HashMap :: new( ) ;
340
340
let mut old_monitors = $old_monitors. latest_monitors. lock( ) . unwrap( ) ;
341
341
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 ) ;
343
343
chain_monitor. latest_monitors. lock( ) . unwrap( ) . insert( outpoint, ( update_id, monitor_ser) ) ;
344
344
}
345
345
let mut monitor_refs = HashMap :: new( ) ;
0 commit comments