Skip to content

Commit b981410

Browse files
committed
f Check for Protocol error also when confirming transactions
1 parent 3a07d54 commit b981410

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

lightning-transaction-sync/src/electrum.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,25 @@ where
213213
let mut watched_txs = Vec::with_capacity(sync_state.watched_transactions.len());
214214

215215
for txid in &sync_state.watched_transactions {
216-
if let Ok(tx) = self.client.transaction_get(&txid) {
217-
watched_txs.push((txid, tx.clone()));
218-
if let Some(tx_out) = tx.output.first() {
219-
// We watch an arbitrary output of the transaction of interest in order to
220-
// retrieve the associated script history, before narrowing down our search
221-
// through `filter`ing by `txid` below.
222-
watched_script_pubkeys.push(tx_out.script_pubkey.clone());
223-
} else {
224-
debug_assert!(false, "Failed due to retrieving invalid tx data.");
225-
log_error!(self.logger, "Failed due to retrieving invalid tx data.");
216+
match self.client.transaction_get(&txid) {
217+
Ok(tx) => {
218+
watched_txs.push((txid, tx.clone()));
219+
if let Some(tx_out) = tx.output.first() {
220+
// We watch an arbitrary output of the transaction of interest in order to
221+
// retrieve the associated script history, before narrowing down our search
222+
// through `filter`ing by `txid` below.
223+
watched_script_pubkeys.push(tx_out.script_pubkey.clone());
224+
} else {
225+
debug_assert!(false, "Failed due to retrieving invalid tx data.");
226+
log_error!(self.logger, "Failed due to retrieving invalid tx data.");
227+
return Err(InternalError::Failed);
228+
}
229+
}
230+
Err(electrum_client::Error::Protocol(_)) => {
231+
// We couldn't find the tx, do nothing.
232+
}
233+
Err(e) => {
234+
log_error!(self.logger, "Failed to look up transaction {}: {}.", txid, e);
226235
return Err(InternalError::Failed);
227236
}
228237
}

0 commit comments

Comments
 (0)