Merge pull request #2617 from wpaulino/no-persist-same-channel-update
[rust-lightning] / lightning / src / ln / channelmanager.rs
index 00becff19d73c5e4a013ec2472addd4c2bdd8cc2..cfa17295a53f37bd8fabd63b54ea4053a27f27eb 100644 (file)
@@ -6756,7 +6756,12 @@ where
                                                return Ok(NotifyOption::SkipPersistNoEvents);
                                        } else {
                                                log_debug!(self.logger, "Received channel_update {:?} for channel {}.", msg, chan_id);
-                                               try_chan_phase_entry!(self, chan.channel_update(&msg), chan_phase_entry);
+                                               let did_change = try_chan_phase_entry!(self, chan.channel_update(&msg), chan_phase_entry);
+                                               // If nothing changed after applying their update, we don't need to bother
+                                               // persisting.
+                                               if !did_change {
+                                                       return Ok(NotifyOption::SkipPersistNoEvents);
+                                               }
                                        }
                                } else {
                                        return try_chan_phase_entry!(self, Err(ChannelError::Close(