Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lightning-transaction-sync/src/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ impl<L: Logger> ElectrumSyncClient<L> {
let mut tip_header = tip_notification.header;
let mut tip_height = tip_notification.height as u32;

loop {
for i in 0..100 {
if i >= 10 {
log_debug!(self.logger, "Giving up trying to do transaction sync after 10 attempts.");
break;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like claude I'm thinking we return Err early here instead of breaking ?

}
Comment on lines +100 to +103
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After break-ing here, execution falls through to the "Finished transaction sync at tip …" log message (and Ok(())), which is misleading — sync didn't actually finish, it gave up. Same issue in esplora.rs.

Consider either:

  • Adding an early return Ok(()) (or return Err(...)) right here so the "Finished" log is skipped, or
  • Guarding the "Finished" log with a check (e.g., if !sync_state.pending_sync).


let pending_registrations = self.queue.lock().unwrap().process_queues(&mut sync_state);
let tip_is_new = Some(tip_header.block_hash()) != sync_state.last_sync_hash;

Expand Down
7 changes: 6 additions & 1 deletion lightning-transaction-sync/src/esplora.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ impl<L: Logger> EsploraSyncClient<L> {

let mut tip_hash = maybe_await!(self.client.get_tip_hash())?;

loop {
for i in 0..100 {
if i >= 10 {
log_debug!(self.logger, "Giving up trying to do transaction sync after 10 attempts.");
break;
}
Comment thread
TheBlueMatt marked this conversation as resolved.

let pending_registrations = self.queue.lock().unwrap().process_queues(&mut sync_state);
let tip_is_new = Some(tip_hash) != sync_state.last_sync_hash;

Expand Down
Loading