Skip to content

Commit dfbacad

Browse files
committed
fix: remove double logging of homeserver error
1 parent 282e9d2 commit dfbacad

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

src/ln_verification/service.rs

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -288,17 +288,7 @@ impl LnVerificationService {
288288
break;
289289
}
290290
for invoice in invoices.iter() {
291-
match self.sync_invoice(&invoice.payment_hash).await {
292-
Ok(_) => {}
293-
// Homeserver unavailable is transient, will retry on next API call or sync
294-
Err(LnVerificationError::HomeserverUnavailable) => {
295-
tracing::warn!(
296-
payment_hash = %invoice.payment_hash.as_str(),
297-
"Homeserver unavailable during catchup sync, will retry later"
298-
);
299-
}
300-
Err(e) => return Err(e),
301-
}
291+
self.sync_invoice(&invoice.payment_hash).await?;
302292
}
303293

304294
offset += limit;
@@ -322,7 +312,13 @@ impl LnVerificationService {
322312
let mut websocket = self.phoenix_api.received_payments_websocket().await?;
323313
tracing::info!("Websocket connected");
324314
tracing::info!("Catching up on paid invoices that we might have missed...");
325-
self.catchup_paid_invoices().await?;
315+
if let Err(e) = self.catchup_paid_invoices().await {
316+
match e {
317+
// Continue gracefully on Homeserver error, will retry on next API call or sync
318+
LnVerificationError::HomeserverUnavailable => {}
319+
e => return Err(e),
320+
}
321+
}
326322
tracing::info!("Listening for live payments...");
327323
loop {
328324
let event = match websocket
@@ -333,16 +329,12 @@ impl LnVerificationService {
333329
Some(event) => event,
334330
None => break, // websocket closed
335331
};
336-
match self.sync_invoice(&event.payment_hash).await {
337-
Ok(_) => {}
338-
// Homeserver unavailable is transient, will retry on next API call or sync
339-
Err(LnVerificationError::HomeserverUnavailable) => {
340-
tracing::warn!(
341-
payment_hash = %event.payment_hash.as_str(),
342-
"Homeserver unavailable during websocket sync, will retry later"
343-
);
332+
if let Err(e) = self.sync_invoice(&event.payment_hash).await {
333+
match e {
334+
// Continue gracefully on Homeserver error, will retry on next API call or sync
335+
LnVerificationError::HomeserverUnavailable => {}
336+
e => return Err(e),
344337
}
345-
Err(e) => return Err(e),
346338
}
347339
}
348340
tracing::warn!("Websocket closed");

0 commit comments

Comments
 (0)