/// The unique identifier used to re-derive the private key material for the channel through
/// [`SignerProvider::derive_channel_signer`].
channel_keys_id: [u8; 32],
+
+ /// When we generate [`ChannelMonitorUpdate`]s to persist, they may not be persisted immediately.
+ /// If we then persist the [`channelmanager::ChannelManager`] and crash before the persistence
+ /// completes we still need to be able to complete the persistence. Thus, we have to keep a
+ /// copy of the [`ChannelMonitorUpdate`] here until it is complete.
+ pending_monitor_updates: Vec<ChannelMonitorUpdate>,
}
#[cfg(any(test, fuzzing))]
channel_type,
channel_keys_id,
+
+ pending_monitor_updates: Vec::new(),
})
}
channel_type,
channel_keys_id,
+
+ pending_monitor_updates: Vec::new(),
};
Ok(chan)
(self.channel_state & ChannelState::MonitorUpdateInProgress as u32) != 0
}
+ pub fn get_next_monitor_update(&self) -> Option<&ChannelMonitorUpdate> {
+ self.pending_monitor_updates.first()
+ }
+
/// Returns true if funding_created was sent/received.
pub fn is_funding_initiated(&self) -> bool {
self.channel_state >= ChannelState::FundingSent as u32
channel_type: channel_type.unwrap(),
channel_keys_id,
+
+ pending_monitor_updates: Vec::new(),
})
}
}