Skip to content

Commit

Permalink
fix(esplora): use saturating_add in update_tx_graph()
Browse files Browse the repository at this point in the history
This fixes overflow error when calling update_tx_graph() from update_tx_graph_without_keychain().
  • Loading branch information
notmandatory committed Sep 6, 2023
1 parent 8a46606 commit c437ef0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/esplora/src/async_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl EsploraAsyncExt for esplora_client::AsyncClient {
}
}

if last_index > last_active_index.map(|i| i + stop_gap as u32) {
if last_index > last_active_index.map(|i| i.saturating_add(stop_gap as u32)) {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/esplora/src/blocking_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl EsploraExt for esplora_client::BlockingClient {
}
}

if last_index > last_active_index.map(|i| i + stop_gap as u32) {
if last_index > last_active_index.map(|i| i.saturating_add(stop_gap as u32)) {
break;
}
}
Expand Down

0 comments on commit c437ef0

Please sign in to comment.