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