- payment_preimage.0.copy_from_slice(&input.witness[3]);
- self.pending_htlcs_updated.push(HTLCUpdate {
- source,
- payment_preimage: Some(payment_preimage),
- payment_hash
- });
+ if !self.pending_htlcs_updated.iter().any(|update| update.source == source) {
+ payment_preimage.0.copy_from_slice(&input.witness[3]);
+ self.pending_htlcs_updated.push(HTLCUpdate {
+ source,
+ payment_preimage: Some(payment_preimage),
+ payment_hash
+ });
+ }