Skip to content

Commit b7e79c6

Browse files
fixup: changes on lsps2/client.rs to avoid clone()
1 parent c50ade5 commit b7e79c6

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

lightning-liquidity/src/lsps2/client.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,21 @@ where
250250
});
251251
}
252252

253-
event_queue_notifier.enqueue(LSPS2ClientEvent::GetInfoFailed {
254-
request_id: request_id.clone(),
255-
counterparty_node_id: *counterparty_node_id,
256-
error: error.clone(),
257-
});
258-
259-
Err(LightningError {
253+
let lightning_error = LightningError {
260254
err: format!(
261255
"Received get_info error response for request {:?}: {:?}",
262256
request_id, error
263257
),
264258
action: ErrorAction::IgnoreAndLog(Level::Error),
265-
})
259+
};
260+
261+
event_queue_notifier.enqueue(LSPS2ClientEvent::GetInfoFailed {
262+
request_id,
263+
counterparty_node_id: *counterparty_node_id,
264+
error,
265+
});
266+
267+
Err(lightning_error)
266268
},
267269
None => {
268270
return Err(LightningError { err: format!("Received error response for a get_info request from an unknown counterparty ({:?})",counterparty_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});
@@ -336,19 +338,21 @@ where
336338
action: ErrorAction::IgnoreAndLog(Level::Info),
337339
})?;
338340

339-
event_queue_notifier.enqueue(LSPS2ClientEvent::BuyRequestFailed {
340-
request_id: request_id.clone(),
341-
counterparty_node_id: *counterparty_node_id,
342-
error: error.clone(),
343-
});
344-
345-
Err(LightningError {
341+
let lightning_error = LightningError {
346342
err: format!(
347343
"Received buy error response for request {:?}: {:?}",
348344
request_id, error
349345
),
350346
action: ErrorAction::IgnoreAndLog(Level::Error),
351-
})
347+
};
348+
349+
event_queue_notifier.enqueue(LSPS2ClientEvent::BuyRequestFailed {
350+
request_id,
351+
counterparty_node_id: *counterparty_node_id,
352+
error,
353+
});
354+
355+
Err(lightning_error)
352356
},
353357
None => {
354358
return Err(LightningError { err: format!("Received error response for a buy request from an unknown counterparty ({:?})", counterparty_node_id), action: ErrorAction::IgnoreAndLog(Level::Info)});

0 commit comments

Comments
 (0)