Skip to content

Commit 8b383bb

Browse files
committed
Fix signed comparison in ElectrumClient
`GetHistoryRes::height` from electrum-client is a *signed* integer. Here we first check for `<= 0` *before* casting to `u32`. Signed-off-by: Elias Rohrer <dev@tnull.de>
1 parent 2313bd5 commit 8b383bb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lightning-transaction-sync/src/electrum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,11 @@ impl<L: Logger> ElectrumSyncClient<L> {
329329
let mut filtered_history =
330330
script_history.iter().filter(|h| h.tx_hash == **txid);
331331
if let Some(history) = filtered_history.next() {
332-
let prob_conf_height = history.height as u32;
333-
if prob_conf_height <= 0 {
332+
if history.height <= 0 {
334333
// Skip if it's a an unconfirmed entry.
335334
continue;
336335
}
336+
let prob_conf_height = history.height as u32;
337337
let confirmed_tx = self.get_confirmed_tx(tx, prob_conf_height)?;
338338
confirmed_txs.push(confirmed_tx);
339339
}

0 commit comments

Comments
 (0)