- let (mut new_outpoints, new_outputs, counterparty_output_idx_sats) =
- self.check_spend_counterparty_transaction(&tx, height, &block_hash, &logger);
- commitment_tx_to_counterparty_output = counterparty_output_idx_sats;
- if !new_outputs.1.is_empty() {
- watch_outputs.push(new_outputs);
- }
- claimable_outpoints.append(&mut new_outpoints);
- if new_outpoints.is_empty() {
- if let Some((mut new_outpoints, new_outputs)) = self.check_spend_holder_transaction(&tx, height, &block_hash, &logger) {
- #[cfg(not(fuzzing))]
- debug_assert!(commitment_tx_to_counterparty_output.is_none(),
- "A commitment transaction matched as both a counterparty and local commitment tx?");
- if !new_outputs.1.is_empty() {
- watch_outputs.push(new_outputs);
- }
- claimable_outpoints.append(&mut new_outpoints);
- balance_spendable_csv = Some(self.on_holder_tx_csv);
+ if let Some((mut new_outpoints, new_outputs)) = self.check_spend_holder_transaction(&tx, height, &block_hash, &logger) {
+ if !new_outputs.1.is_empty() {
+ watch_outputs.push(new_outputs);
+ }
+
+ claimable_outpoints.append(&mut new_outpoints);
+ balance_spendable_csv = Some(self.on_holder_tx_csv);
+ } else {
+ let mut new_watch_outputs = Vec::new();
+ for (idx, outp) in tx.output.iter().enumerate() {
+ new_watch_outputs.push((idx as u32, outp.clone()));