@@ -140,28 +140,6 @@ impl Readable for SpendableOutputDescriptor {
140
140
}
141
141
}
142
142
143
- /// A trait to describe an object which can get user secrets and key material.
144
- pub trait KeysInterface : Send + Sync {
145
- /// A type which implements ChannelKeys which will be returned by get_channel_keys.
146
- type ChanKeySigner : ChannelKeys ;
147
-
148
- /// Get node secret key (aka node_id or network_key)
149
- fn get_node_secret ( & self ) -> SecretKey ;
150
- /// Get destination redeemScript to encumber static protocol exit points.
151
- fn get_destination_script ( & self ) -> Script ;
152
- /// Get shutdown_pubkey to use as PublicKey at channel closure
153
- fn get_shutdown_pubkey ( & self ) -> PublicKey ;
154
- /// Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
155
- /// restarted with some stale data!
156
- fn get_channel_keys ( & self , inbound : bool , channel_value_satoshis : u64 ) -> Self :: ChanKeySigner ;
157
- /// Get a secret and PRNG seed for construting an onion packet
158
- fn get_onion_rand ( & self ) -> ( SecretKey , [ u8 ; 32 ] ) ;
159
- /// Get a unique temporary channel id. Channels will be referred to by this until the funding
160
- /// transaction is created, at which point they will use the outpoint in the funding
161
- /// transaction.
162
- fn get_channel_id ( & self ) -> [ u8 ; 32 ] ;
163
- }
164
-
165
143
/// Set of lightning keys needed to operate a channel as described in BOLT 3.
166
144
///
167
145
/// Signing services could be implemented on a hardware wallet. In this case,
@@ -267,6 +245,29 @@ pub trait ChannelKeys : Send+Clone {
267
245
fn set_remote_channel_pubkeys ( & mut self , channel_points : & ChannelPublicKeys ) ;
268
246
}
269
247
248
+
249
+ /// A trait to describe an object which can get user secrets and key material.
250
+ pub trait KeysInterface : Send + Sync {
251
+ /// A type which implements ChannelKeys which will be returned by get_channel_keys.
252
+ type ChanKeySigner : ChannelKeys ;
253
+
254
+ /// Get node secret key (aka node_id or network_key)
255
+ fn get_node_secret ( & self ) -> SecretKey ;
256
+ /// Get destination redeemScript to encumber static protocol exit points.
257
+ fn get_destination_script ( & self ) -> Script ;
258
+ /// Get shutdown_pubkey to use as PublicKey at channel closure
259
+ fn get_shutdown_pubkey ( & self ) -> PublicKey ;
260
+ /// Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
261
+ /// restarted with some stale data!
262
+ fn get_channel_keys ( & self , inbound : bool , channel_value_satoshis : u64 ) -> Self :: ChanKeySigner ;
263
+ /// Get a secret and PRNG seed for construting an onion packet
264
+ fn get_onion_rand ( & self ) -> ( SecretKey , [ u8 ; 32 ] ) ;
265
+ /// Get a unique temporary channel id. Channels will be referred to by this until the funding
266
+ /// transaction is created, at which point they will use the outpoint in the funding
267
+ /// transaction.
268
+ fn get_channel_id ( & self ) -> [ u8 ; 32 ] ;
269
+ }
270
+
270
271
#[ derive( Clone ) ]
271
272
/// A simple implementation of ChannelKeys that just keeps the private keys in memory.
272
273
pub struct InMemoryChannelKeys {
@@ -506,7 +507,7 @@ impl KeysManager {
506
507
/// Note that until the 0.1 release there is no guarantee of backward compatibility between
507
508
/// versions. Once the library is more fully supported, the docs will be updated to include a
508
509
/// detailed description of the guarantee.
509
- pub fn new ( seed : & [ u8 ; 32 ] , network : Network , starting_time_secs : u64 , starting_time_nanos : u32 ) -> KeysManager {
510
+ pub fn new ( seed : & [ u8 ; 32 ] , network : Network , starting_time_secs : u64 , starting_time_nanos : u32 ) -> Self {
510
511
let secp_ctx = Secp256k1 :: signing_only ( ) ;
511
512
match ExtendedPrivKey :: new_master ( network. clone ( ) , seed) {
512
513
Ok ( master_key) => {
0 commit comments