From 7ade07cb28dffd001c28e1d19fa419ee13b30677 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Sat, 23 Sep 2023 21:04:47 -0500 Subject: [PATCH] Don't persist NetworkGraph We no longer read the graph from storage, we just get it from RGS on boot, so there's no reason to persist it. We can also not save it in our memory storage because we don't need to read it. --- mutiny-core/src/ldkstorage.rs | 6 ++---- mutiny-wasm/src/indexed_db.rs | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mutiny-core/src/ldkstorage.rs b/mutiny-core/src/ldkstorage.rs index cd1c8a3d9..e7797fff4 100644 --- a/mutiny-core/src/ldkstorage.rs +++ b/mutiny-core/src/ldkstorage.rs @@ -606,10 +606,8 @@ impl .map_err(|_| lightning::io::ErrorKind::Other.into()) } - fn persist_graph(&self, network_graph: &NetworkGraph) -> Result<(), lightning::io::Error> { - self.storage - .set_data(NETWORK_GRAPH_KEY, network_graph.encode().to_hex(), None) - .map_err(|_| lightning::io::ErrorKind::Other.into()) + fn persist_graph(&self, _network_graph: &NetworkGraph) -> Result<(), lightning::io::Error> { + Ok(()) } fn persist_scorer( diff --git a/mutiny-wasm/src/indexed_db.rs b/mutiny-wasm/src/indexed_db.rs index 336c304b4..631906753 100644 --- a/mutiny-wasm/src/indexed_db.rs +++ b/mutiny-wasm/src/indexed_db.rs @@ -194,6 +194,12 @@ impl IndexedDbStorage { "key from indexedDB is not a string" ))))?; + // we no longer need to read this key, + // so we can remove it from memory + if key == NETWORK_GRAPH_KEY { + continue; + } + let json: Value = value.into_serde()?; map.set(key, json)?; }