Remove PersistenceNotifierGuard from splice_channel
What changed, and why it matters
This commit is a small internal cleanup in a Bitcoin Lightning Network library. It removes an unnecessary 'persistence notification' wrapper from a function called splice_channel because that function now only reads data instead of changing it. There is no indication this fixes a security bug or introduces a vulnerability.
No security action required. Treat as normal maintenance/refactoring commit. Reviewers may verify that splice_channel is indeed read-only and that no other mutation paths were accidentally removed.
Security signals we found
No security-relevant signal: change is a read-only refactor removing an obsolete persistence-notification wrapper.
No bounds, lifetime, concurrency, or cryptographic changes observed.
No incident, CVE, or advisory references supplied or present in commit message.
Evidence from the diff
The change refactors ChannelManager::splice_channel to drop the PersistenceNotifierGuard and the internal_splice_channel helper. The underlying Channel::splice_channel method is changed from &mut self to &self, confirming it is now read-only. The caller in ChannelManager is updated to use non-mutable entry accessors (get() and as_funded()). The removed PersistenceNotifierGuard was previously used to notify listeners and trigger persistence when state changed; since the function no longer mutates channel state, that guard is unnecessary. This is a defensive code-quality change, not a security patch.
Changed components
lightning/src/ln/channel.rslightning/src/ln/channelmanager.rsInspect captured patch +3 / −17
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index 85a23ca..5bea1c9 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -12136,7 +12136,7 @@ where
}
/// Initiate splicing.
- pub fn splice_channel(&mut self, feerate: FeeRate) -> Result<FundingTemplate, APIError> {
+ pub fn splice_channel(&self, feerate: FeeRate) -> Result<FundingTemplate, APIError> {
if self.holder_commitment_point.current_point().is_none() {
return Err(APIError::APIMisuseError {
err: format!(
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 75de6ab..667b7de 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -4576,20 +4576,6 @@ impl<
#[rustfmt::skip]
pub fn splice_channel(
&self, channel_id: &ChannelId, counterparty_node_id: &PublicKey, feerate: FeeRate,
- ) -> Result<FundingTemplate, APIError> {
- let mut res = Err(APIError::APIMisuseError { err: String::new() });
- PersistenceNotifierGuard::optionally_notify(self, || {
- let result = self.internal_splice_channel(
- channel_id, counterparty_node_id, feerate,
- );
- res = result;
- NotifyOption::SkipPersistNoEvents
- });
- res
- }
-
- fn internal_splice_channel(
- &self, channel_id: &ChannelId, counterparty_node_id: &PublicKey, feerate: FeeRate,
) -> Result<FundingTemplate, APIError> {
let per_peer_state = self.per_peer_state.read().unwrap();
@@ -4615,8 +4601,8 @@ impl<
// Look for the channel
match peer_state.channel_by_id.entry(*channel_id) {
- hash_map::Entry::Occupied(mut chan_phase_entry) => {
- if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
+ hash_map::Entry::Occupied(chan_phase_entry) => {
+ if let Some(chan) = chan_phase_entry.get().as_funded() {
chan.splice_channel(feerate)
} else {
Err(APIError::ChannelUnavailable {
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.