]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Update storage constants to new PRIMARY/SECONDARY namespace terms
authorMatt Corallo <git@bluematt.me>
Thu, 28 Sep 2023 17:06:20 +0000 (17:06 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 28 Sep 2023 18:35:38 +0000 (18:35 +0000)
lightning-background-processor/src/lib.rs
lightning/src/util/persist.rs

index 7ae14b4b4aabd5e92c3a610b5cfd622c2314264f..e0c71bfcf92b83abed9bce9e138c9cb34c823f5b 100644 (file)
@@ -868,7 +868,10 @@ mod tests {
        use lightning::util::config::UserConfig;
        use lightning::util::ser::Writeable;
        use lightning::util::test_utils;
-       use lightning::util::persist::{KVStore, CHANNEL_MANAGER_PERSISTENCE_NAMESPACE, CHANNEL_MANAGER_PERSISTENCE_SUB_NAMESPACE, CHANNEL_MANAGER_PERSISTENCE_KEY, NETWORK_GRAPH_PERSISTENCE_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_SUB_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_KEY, SCORER_PERSISTENCE_NAMESPACE, SCORER_PERSISTENCE_SUB_NAMESPACE, SCORER_PERSISTENCE_KEY};
+       use lightning::util::persist::{KVStore,
+               CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE, CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE, CHANNEL_MANAGER_PERSISTENCE_KEY,
+               NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE, NETWORK_GRAPH_PERSISTENCE_KEY,
+               SCORER_PERSISTENCE_PRIMARY_NAMESPACE, SCORER_PERSISTENCE_SECONDARY_NAMESPACE, SCORER_PERSISTENCE_KEY};
        use lightning_persister::fs_store::FilesystemStore;
        use std::collections::VecDeque;
        use std::{fs, env};
@@ -988,8 +991,8 @@ mod tests {
                }
 
                fn write(&self, namespace: &str, sub_namespace: &str, key: &str, buf: &[u8]) -> lightning::io::Result<()> {
-                       if namespace == CHANNEL_MANAGER_PERSISTENCE_NAMESPACE &&
-                               sub_namespace == CHANNEL_MANAGER_PERSISTENCE_SUB_NAMESPACE &&
+                       if namespace == CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE &&
+                               sub_namespace == CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE &&
                                key == CHANNEL_MANAGER_PERSISTENCE_KEY
                        {
                                if let Some((error, message)) = self.manager_error {
@@ -997,8 +1000,8 @@ mod tests {
                                }
                        }
 
-                       if namespace == NETWORK_GRAPH_PERSISTENCE_NAMESPACE &&
-                               sub_namespace == NETWORK_GRAPH_PERSISTENCE_SUB_NAMESPACE &&
+                       if namespace == NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE &&
+                               sub_namespace == NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE &&
                                key == NETWORK_GRAPH_PERSISTENCE_KEY
                        {
                                if let Some(sender) = &self.graph_persistence_notifier {
@@ -1013,8 +1016,8 @@ mod tests {
                                }
                        }
 
-                       if namespace == SCORER_PERSISTENCE_NAMESPACE &&
-                               sub_namespace == SCORER_PERSISTENCE_SUB_NAMESPACE &&
+                       if namespace == SCORER_PERSISTENCE_PRIMARY_NAMESPACE &&
+                               sub_namespace == SCORER_PERSISTENCE_SECONDARY_NAMESPACE &&
                                key == SCORER_PERSISTENCE_KEY
                        {
                                if let Some((error, message)) = self.scorer_error {
index f3b8187fc641b88102c808b34d0a76683852e594..2a022c37cc4a476e3bd3c2ecac076b53f25e9d87 100644 (file)
@@ -37,31 +37,31 @@ pub const KVSTORE_NAMESPACE_KEY_ALPHABET: &str = "abcdefghijklmnopqrstuvwxyzABCD
 /// The maximum number of characters namespaces and keys may have.
 pub const KVSTORE_NAMESPACE_KEY_MAX_LEN: usize = 120;
 
-/// The namespace under which the [`ChannelManager`] will be persisted.
-pub const CHANNEL_MANAGER_PERSISTENCE_NAMESPACE: &str = "";
-/// The secondary-namespace under which the [`ChannelManager`] will be persisted.
-pub const CHANNEL_MANAGER_PERSISTENCE_SUB_NAMESPACE: &str = "";
+/// The primary namespace under which the [`ChannelManager`] will be persisted.
+pub const CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE: &str = "";
+/// The secondary namespace under which the [`ChannelManager`] will be persisted.
+pub const CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE: &str = "";
 /// The key under which the [`ChannelManager`] will be persisted.
 pub const CHANNEL_MANAGER_PERSISTENCE_KEY: &str = "manager";
 
-/// The namespace under which [`ChannelMonitor`]s will be persisted.
-pub const CHANNEL_MONITOR_PERSISTENCE_NAMESPACE: &str = "monitors";
-/// The secondary-namespace under which [`ChannelMonitor`]s will be persisted.
-pub const CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE: &str = "";
-/// The namespace under which [`ChannelMonitorUpdate`]s will be persisted.
-pub const CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE: &str = "monitor_updates";
-
-/// The namespace under which the [`NetworkGraph`] will be persisted.
-pub const NETWORK_GRAPH_PERSISTENCE_NAMESPACE: &str = "";
-/// The secondary-namespace under which the [`NetworkGraph`] will be persisted.
-pub const NETWORK_GRAPH_PERSISTENCE_SUB_NAMESPACE: &str = "";
+/// The primary namespace under which [`ChannelMonitor`]s will be persisted.
+pub const CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE: &str = "monitors";
+/// The secondary namespace under which [`ChannelMonitor`]s will be persisted.
+pub const CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE: &str = "";
+/// The primary namespace under which [`ChannelMonitorUpdate`]s will be persisted.
+pub const CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE: &str = "monitor_updates";
+
+/// The primary namespace under which the [`NetworkGraph`] will be persisted.
+pub const NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE: &str = "";
+/// The secondary namespace under which the [`NetworkGraph`] will be persisted.
+pub const NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE: &str = "";
 /// The key under which the [`NetworkGraph`] will be persisted.
 pub const NETWORK_GRAPH_PERSISTENCE_KEY: &str = "network_graph";
 
-/// The namespace under which the [`WriteableScore`] will be persisted.
-pub const SCORER_PERSISTENCE_NAMESPACE: &str = "";
-/// The secondary-namespace under which the [`WriteableScore`] will be persisted.
-pub const SCORER_PERSISTENCE_SUB_NAMESPACE: &str = "";
+/// The primary namespace under which the [`WriteableScore`] will be persisted.
+pub const SCORER_PERSISTENCE_PRIMARY_NAMESPACE: &str = "";
+/// The secondary namespace under which the [`WriteableScore`] will be persisted.
+pub const SCORER_PERSISTENCE_SECONDARY_NAMESPACE: &str = "";
 /// The key under which the [`WriteableScore`] will be persisted.
 pub const SCORER_PERSISTENCE_KEY: &str = "scorer";
 
@@ -164,26 +164,26 @@ impl<'a, A: KVStore, M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Der
 {
        /// Persist the given [`ChannelManager`] to disk, returning an error if persistence failed.
        fn persist_manager(&self, channel_manager: &ChannelManager<M, T, ES, NS, SP, F, R, L>) -> Result<(), io::Error> {
-               self.write(CHANNEL_MANAGER_PERSISTENCE_NAMESPACE,
-                                  CHANNEL_MANAGER_PERSISTENCE_SUB_NAMESPACE,
-                                  CHANNEL_MANAGER_PERSISTENCE_KEY,
-                                  &channel_manager.encode())
+               self.write(CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
+                       CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE,
+                       CHANNEL_MANAGER_PERSISTENCE_KEY,
+                       &channel_manager.encode())
        }
 
        /// Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
        fn persist_graph(&self, network_graph: &NetworkGraph<L>) -> Result<(), io::Error> {
-               self.write(NETWORK_GRAPH_PERSISTENCE_NAMESPACE,
-                                  NETWORK_GRAPH_PERSISTENCE_SUB_NAMESPACE,
-                                  NETWORK_GRAPH_PERSISTENCE_KEY,
-                                  &network_graph.encode())
+               self.write(NETWORK_GRAPH_PERSISTENCE_PRIMARY_NAMESPACE,
+                       NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE,
+                       NETWORK_GRAPH_PERSISTENCE_KEY,
+                       &network_graph.encode())
        }
 
        /// Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
        fn persist_scorer(&self, scorer: &S) -> Result<(), io::Error> {
-               self.write(SCORER_PERSISTENCE_NAMESPACE,
-                                  SCORER_PERSISTENCE_SUB_NAMESPACE,
-                                  SCORER_PERSISTENCE_KEY,
-                                  &scorer.encode())
+               self.write(SCORER_PERSISTENCE_PRIMARY_NAMESPACE,
+                       SCORER_PERSISTENCE_SECONDARY_NAMESPACE,
+                       SCORER_PERSISTENCE_KEY,
+                       &scorer.encode())
        }
 }
 
@@ -196,8 +196,8 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner, K: KVStore> Persist<ChannelSign
        fn persist_new_channel(&self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChannelSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
                let key = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index);
                match self.write(
-                       CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
-                       CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
                        &key, &monitor.encode())
                {
                        Ok(()) => chain::ChannelMonitorUpdateStatus::Completed,
@@ -208,8 +208,8 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner, K: KVStore> Persist<ChannelSign
        fn update_persisted_channel(&self, funding_txo: OutPoint, _update: Option<&ChannelMonitorUpdate>, monitor: &ChannelMonitor<ChannelSigner>, _update_id: MonitorUpdateId) -> chain::ChannelMonitorUpdateStatus {
                let key = format!("{}_{}", funding_txo.txid.to_hex(), funding_txo.index);
                match self.write(
-                       CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
-                       CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
                        &key, &monitor.encode())
                {
                        Ok(()) => chain::ChannelMonitorUpdateStatus::Completed,
@@ -230,7 +230,7 @@ where
        let mut res = Vec::new();
 
        for stored_key in kv_store.list(
-               CHANNEL_MONITOR_PERSISTENCE_NAMESPACE, CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE)?
+               CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE, CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE)?
        {
                if stored_key.len() < 66 {
                        return Err(io::Error::new(
@@ -248,7 +248,7 @@ where
 
                match <(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>::read(
                        &mut io::Cursor::new(
-                               kv_store.read(CHANNEL_MONITOR_PERSISTENCE_NAMESPACE, CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE, &stored_key)?),
+                               kv_store.read(CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE, CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE, &stored_key)?),
                        (&*entropy_source, &*signer_provider),
                ) {
                        Ok((block_hash, channel_monitor)) => {
@@ -299,12 +299,12 @@ where
 ///   - [`Persist::persist_new_channel`], which persists whole [`ChannelMonitor`]s.
 ///   - [`Persist::update_persisted_channel`], which persists only a [`ChannelMonitorUpdate`]
 ///
-/// Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_NAMESPACE`], using the
-/// familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`).
+/// Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE`],
+/// using the familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`).
 ///
 /// Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows:
 ///
-///   - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE`]
+///   - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE`]
 ///   - secondary namespace: [the monitor's encoded outpoint name]
 ///
 /// Under that secondary namespace, each update is stored with a number string, like `21`, which
@@ -317,14 +317,14 @@ where
 ///
 /// Full channel monitors would be stored at a single key:
 ///
-/// `[CHANNEL_MONITOR_PERSISTENCE_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1`
+/// `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1`
 ///
 /// Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key):
 ///
 /// ```text
-/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1
-/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2
-/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3
+/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1
+/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2
+/// [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3
 /// ```
 /// ... and so on.
 ///
@@ -426,8 +426,8 @@ where
                F::Target: FeeEstimator,
        {
                let monitor_list = self.kv_store.list(
-                       CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
-                       CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
                )?;
                let mut res = Vec::with_capacity(monitor_list.len());
                for monitor_key in monitor_list {
@@ -505,8 +505,8 @@ where
        ) -> Result<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>), io::Error> {
                let outpoint: OutPoint = monitor_name.try_into()?;
                let mut monitor_cursor = io::Cursor::new(self.kv_store.read(
-                       CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
-                       CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
                        monitor_name.as_str(),
                )?);
                // Discard the sentinel bytes if found.
@@ -551,7 +551,7 @@ where
                &self, monitor_name: &MonitorName, update_name: &UpdateName,
        ) -> Result<ChannelMonitorUpdate, io::Error> {
                let update_bytes = self.kv_store.read(
-                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                        monitor_name.as_str(),
                        update_name.as_str(),
                )?;
@@ -559,7 +559,7 @@ where
                        log_error!(
                                self.logger,
                                "Failed to read ChannelMonitorUpdate {}/{}/{}, reason: {}",
-                               CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                               CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                                monitor_name.as_str(),
                                update_name.as_str(),
                                e,
@@ -576,21 +576,21 @@ where
        /// be passed to [`KVStore::remove`].
        pub fn cleanup_stale_updates(&self, lazy: bool) -> Result<(), io::Error> {
                let monitor_keys = self.kv_store.list(
-                       CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
-                       CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
                )?;
                for monitor_key in monitor_keys {
                        let monitor_name = MonitorName::new(monitor_key)?;
                        let (_, current_monitor) = self.read_monitor(&monitor_name)?;
                        let updates = self
                                .kv_store
-                               .list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE, monitor_name.as_str())?;
+                               .list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE, monitor_name.as_str())?;
                        for update in updates {
                                let update_name = UpdateName::new(update)?;
                                // if the update_id is lower than the stored monitor, delete
                                if update_name.0 <= current_monitor.get_latest_update_id() {
                                        self.kv_store.remove(
-                                               CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                                               CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                                                monitor_name.as_str(),
                                                update_name.as_str(),
                                                lazy,
@@ -643,8 +643,8 @@ where
                monitor_bytes.extend_from_slice(MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL);
                monitor.write(&mut monitor_bytes).unwrap();
                match self.kv_store.write(
-                       CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
-                       CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
+                       CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
                        monitor_name.as_str(),
                        &monitor_bytes,
                ) {
@@ -688,7 +688,7 @@ where
                                                        // stale updates, so do nothing.
                                                }
                                                if let Err(e) = self.kv_store.remove(
-                                                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                                                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                                                        monitor_name.as_str(),
                                                        update_name.as_str(),
                                                        true,
@@ -708,8 +708,8 @@ where
                                log_error!(
                                        self.logger,
                                        "error writing channel monitor {}/{}/{} reason: {}",
-                                       CHANNEL_MONITOR_PERSISTENCE_NAMESPACE,
-                                       CHANNEL_MONITOR_PERSISTENCE_SUB_NAMESPACE,
+                                       CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE,
+                                       CHANNEL_MONITOR_PERSISTENCE_SECONDARY_NAMESPACE,
                                        monitor_name.as_str(),
                                        e
                                );
@@ -740,7 +740,7 @@ where
                                let monitor_name = MonitorName::from(funding_txo);
                                let update_name = UpdateName::from(update.update_id);
                                match self.kv_store.write(
-                                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                                        monitor_name.as_str(),
                                        update_name.as_str(),
                                        &update.encode(),
@@ -750,7 +750,7 @@ where
                                                log_error!(
                                                        self.logger,
                                                        "error writing channel monitor update {}/{}/{} reason: {}",
-                                                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                                                       CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                                                        monitor_name.as_str(),
                                                        update_name.as_str(),
                                                        e
@@ -970,7 +970,7 @@ mod tests {
                                        let (_, cm_0) = persister_0.read_monitor(&monitor_name).unwrap();
                                        if cm_0.get_latest_update_id() == $expected_update_id {
                                                assert_eq!(
-                                                       persister_0.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                                                       persister_0.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                                                                monitor_name.as_str()).unwrap().len(),
                                                        0,
                                                        "updates stored when they shouldn't be in persister 0"
@@ -986,7 +986,7 @@ mod tests {
                                        let (_, cm_1) = persister_1.read_monitor(&monitor_name).unwrap();
                                        if cm_1.get_latest_update_id() == $expected_update_id {
                                                assert_eq!(
-                                                       persister_1.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE,
+                                                       persister_1.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE,
                                                                monitor_name.as_str()).unwrap().len(),
                                                        0,
                                                        "updates stored when they shouldn't be in persister 1"
@@ -1047,8 +1047,8 @@ mod tests {
                let (_, monitor) = &persisted_chan_data[0];
                let monitor_name = MonitorName::from(monitor.get_funding_txo().0);
                // The channel should have 0 updates, as it wrote a full monitor and consolidated.
-               assert_eq!(persister_0.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE, monitor_name.as_str()).unwrap().len(), 0);
-               assert_eq!(persister_1.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE, monitor_name.as_str()).unwrap().len(), 0);
+               assert_eq!(persister_0.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE, monitor_name.as_str()).unwrap().len(), 0);
+               assert_eq!(persister_1.kv_store.list(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE, monitor_name.as_str()).unwrap().len(), 0);
        }
 
        // Test that if the `MonitorUpdatingPersister`'s can't actually write, trying to persist a
@@ -1167,7 +1167,7 @@ mod tests {
                let monitor_name = MonitorName::from(monitor.get_funding_txo().0);
                persister_0
                        .kv_store
-                       .write(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE, monitor_name.as_str(), UpdateName::from(1).as_str(), &[0u8; 1])
+                       .write(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE, monitor_name.as_str(), UpdateName::from(1).as_str(), &[0u8; 1])
                        .unwrap();
 
                // Do the stale update cleanup
@@ -1176,7 +1176,7 @@ mod tests {
                // Confirm the stale update is unreadable/gone
                assert!(persister_0
                        .kv_store
-                       .read(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE, monitor_name.as_str(), UpdateName::from(1).as_str())
+                       .read(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE, monitor_name.as_str(), UpdateName::from(1).as_str())
                        .is_err());
 
                // Force close.
@@ -1188,7 +1188,7 @@ mod tests {
                // Write an update near u64::MAX
                persister_0
                        .kv_store
-                       .write(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE, monitor_name.as_str(), UpdateName::from(u64::MAX - 1).as_str(), &[0u8; 1])
+                       .write(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE, monitor_name.as_str(), UpdateName::from(u64::MAX - 1).as_str(), &[0u8; 1])
                        .unwrap();
 
                // Do the stale update cleanup
@@ -1197,7 +1197,7 @@ mod tests {
                // Confirm the stale update is unreadable/gone
                assert!(persister_0
                        .kv_store
-                       .read(CHANNEL_MONITOR_UPDATE_PERSISTENCE_NAMESPACE, monitor_name.as_str(), UpdateName::from(u64::MAX - 1).as_str())
+                       .read(CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE, monitor_name.as_str(), UpdateName::from(u64::MAX - 1).as_str())
                        .is_err());
        }
 }