@@ -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,28 @@ pub trait ChannelKeys : Send+Clone {
267
245
fn set_remote_channel_pubkeys ( & mut self , channel_points : & ChannelPublicKeys ) ;
268
246
}
269
247
248
+ /// A trait to describe an object which can get user secrets and key material.
249
+ pub trait KeysInterface : Send + Sync {
250
+ /// A type which implements ChannelKeys which will be returned by get_channel_keys.
251
+ type ChanKeySigner : ChannelKeys ;
252
+
253
+ /// Get node secret key (aka node_id or network_key)
254
+ fn get_node_secret ( & self ) -> SecretKey ;
255
+ /// Get destination redeemScript to encumber static protocol exit points.
256
+ fn get_destination_script ( & self ) -> Script ;
257
+ /// Get shutdown_pubkey to use as PublicKey at channel closure
258
+ fn get_shutdown_pubkey ( & self ) -> PublicKey ;
259
+ /// Get a new set of ChannelKeys for per-channel secrets. These MUST be unique even if you
260
+ /// restarted with some stale data!
261
+ fn get_channel_keys ( & self , inbound : bool , channel_value_satoshis : u64 ) -> Self :: ChanKeySigner ;
262
+ /// Get a secret and PRNG seed for constructing an onion packet
263
+ fn get_onion_rand ( & self ) -> ( SecretKey , [ u8 ; 32 ] ) ;
264
+ /// Get a unique temporary channel id. Channels will be referred to by this until the funding
265
+ /// transaction is created, at which point they will use the outpoint in the funding
266
+ /// transaction.
267
+ fn get_channel_id ( & self ) -> [ u8 ; 32 ] ;
268
+ }
269
+
270
270
#[ derive( Clone ) ]
271
271
/// A simple implementation of ChannelKeys that just keeps the private keys in memory.
272
272
pub struct InMemoryChannelKeys {
@@ -506,7 +506,7 @@ impl KeysManager {
506
506
/// Note that until the 0.1 release there is no guarantee of backward compatibility between
507
507
/// versions. Once the library is more fully supported, the docs will be updated to include a
508
508
/// detailed description of the guarantee.
509
- pub fn new ( seed : & [ u8 ; 32 ] , network : Network , starting_time_secs : u64 , starting_time_nanos : u32 ) -> KeysManager {
509
+ pub fn new ( seed : & [ u8 ; 32 ] , network : Network , starting_time_secs : u64 , starting_time_nanos : u32 ) -> Self {
510
510
let secp_ctx = Secp256k1 :: signing_only ( ) ;
511
511
match ExtendedPrivKey :: new_master ( network. clone ( ) , seed) {
512
512
Ok ( master_key) => {
0 commit comments