@@ -215,19 +215,18 @@ impl Builder {
215
215
. expect ( "Failed to read wallet master key" ) ;
216
216
217
217
let wallet_name = bdk:: wallet:: wallet_name_from_descriptor (
218
- Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: External ) ,
219
- Some ( Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: Internal ) ) ,
218
+ Bip84 ( xprv, bdk:: KeychainKind :: External ) ,
219
+ Some ( Bip84 ( xprv, bdk:: KeychainKind :: Internal ) ) ,
220
220
config. network ,
221
221
& Secp256k1 :: new ( ) ,
222
222
)
223
223
. expect ( "Failed to derive on-chain wallet name" ) ;
224
224
let database = sled:: open ( bdk_data_dir) . expect ( "Failed to open BDK database" ) ;
225
- let database =
226
- database. open_tree ( wallet_name. clone ( ) ) . expect ( "Failed to open BDK database" ) ;
225
+ let database = database. open_tree ( wallet_name) . expect ( "Failed to open BDK database" ) ;
227
226
228
227
let bdk_wallet = bdk:: Wallet :: new (
229
- Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: External ) ,
230
- Some ( Bip84 ( xprv. clone ( ) , bdk:: KeychainKind :: Internal ) ) ,
228
+ Bip84 ( xprv, bdk:: KeychainKind :: External ) ,
229
+ Some ( Bip84 ( xprv, bdk:: KeychainKind :: Internal ) ) ,
231
230
config. network ,
232
231
database,
233
232
)
@@ -294,7 +293,7 @@ impl Builder {
294
293
let mut user_config = UserConfig :: default ( ) ;
295
294
user_config. channel_handshake_limits . force_announced_channel_preference = false ;
296
295
let channel_manager = {
297
- if let Ok ( mut f) = fs:: File :: open ( format ! ( "{}/manager" , ldk_data_dir. clone ( ) ) ) {
296
+ if let Ok ( mut f) = fs:: File :: open ( format ! ( "{}/manager" , ldk_data_dir) ) {
298
297
let mut channel_monitor_mut_references = Vec :: new ( ) ;
299
298
for ( _, channel_monitor) in channel_monitors. iter_mut ( ) {
300
299
channel_monitor_mut_references. push ( channel_monitor) ;
@@ -325,7 +324,7 @@ impl Builder {
325
324
network : config. network ,
326
325
best_block : BestBlock :: new ( dummy_block_hash, 0 ) ,
327
326
} ;
328
- let fresh_channel_manager = channelmanager:: ChannelManager :: new (
327
+ channelmanager:: ChannelManager :: new (
329
328
Arc :: clone ( & wallet) ,
330
329
Arc :: clone ( & chain_monitor) ,
331
330
Arc :: clone ( & wallet) ,
@@ -336,8 +335,7 @@ impl Builder {
336
335
Arc :: clone ( & keys_manager) ,
337
336
user_config,
338
337
chain_params,
339
- ) ;
340
- fresh_channel_manager
338
+ )
341
339
}
342
340
} ;
343
341
@@ -389,7 +387,7 @@ impl Builder {
389
387
390
388
// Step 14: Restore event handler from disk or create a new one.
391
389
let event_queue = if let Ok ( mut f) =
392
- fs:: File :: open ( format ! ( "{}/{}" , ldk_data_dir. clone ( ) , event:: EVENTS_PERSISTENCE_KEY ) )
390
+ fs:: File :: open ( format ! ( "{}/{}" , ldk_data_dir, event:: EVENTS_PERSISTENCE_KEY ) )
393
391
{
394
392
Arc :: new (
395
393
EventQueue :: read ( & mut f, Arc :: clone ( & persister) )
@@ -399,11 +397,9 @@ impl Builder {
399
397
Arc :: new ( EventQueue :: new ( Arc :: clone ( & persister) ) )
400
398
} ;
401
399
402
- let peer_store = if let Ok ( mut f) = fs:: File :: open ( format ! (
403
- "{}/{}" ,
404
- ldk_data_dir. clone( ) ,
405
- peer_store:: PEER_INFO_PERSISTENCE_KEY
406
- ) ) {
400
+ let peer_store = if let Ok ( mut f) =
401
+ fs:: File :: open ( format ! ( "{}/{}" , ldk_data_dir, peer_store:: PEER_INFO_PERSISTENCE_KEY ) )
402
+ {
407
403
Arc :: new (
408
404
PeerInfoStorage :: read ( & mut f, Arc :: clone ( & persister) )
409
405
. expect ( "Failed to read peer information from disk." ) ,
@@ -652,7 +648,7 @@ impl Node {
652
648
if peer_info. pubkey == node_id {
653
649
let _ = do_connect_peer (
654
650
peer_info. pubkey ,
655
- peer_info. address . clone ( ) ,
651
+ peer_info. address ,
656
652
Arc :: clone ( & connect_pm) ,
657
653
Arc :: clone ( & connect_logger) ,
658
654
)
@@ -868,8 +864,8 @@ impl Node {
868
864
}
869
865
} ;
870
866
871
- let payment_hash = PaymentHash ( invoice. payment_hash ( ) . clone ( ) . into_inner ( ) ) ;
872
- let payment_secret = Some ( invoice. payment_secret ( ) . clone ( ) ) ;
867
+ let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
868
+ let payment_secret = Some ( * invoice. payment_secret ( ) ) ;
873
869
874
870
let mut outbound_payments_lock = self . outbound_payments . lock ( ) . unwrap ( ) ;
875
871
outbound_payments_lock. insert (
@@ -965,20 +961,20 @@ impl Node {
965
961
}
966
962
} ;
967
963
968
- let payment_hash = PaymentHash ( invoice. payment_hash ( ) . clone ( ) . into_inner ( ) ) ;
964
+ let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
969
965
inbound_payments_lock. insert (
970
966
payment_hash,
971
967
PaymentInfo {
972
968
preimage : None ,
973
- secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
969
+ secret : Some ( * invoice. payment_secret ( ) ) ,
974
970
status : PaymentStatus :: Pending ,
975
971
amount_msat,
976
972
} ,
977
973
) ;
978
974
Ok ( invoice)
979
975
}
980
976
981
- /// Query for information about the status of a specific payment.
977
+ /// Query for information about the status of a specific payment.
982
978
pub fn payment_info ( & self , payment_hash : & [ u8 ; 32 ] ) -> Option < PaymentInfo > {
983
979
let payment_hash = PaymentHash ( * payment_hash) ;
984
980
0 commit comments