Skip to content

Commit

Permalink
Don't persist NetworkGraph
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
benthecarman committed Sep 24, 2023
1 parent 271e1b8 commit 7ade07c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mutiny-core/src/ldkstorage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,8 @@ impl<S: MutinyStorage>
.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(
Expand Down
6 changes: 6 additions & 0 deletions mutiny-wasm/src/indexed_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
}
Expand Down

0 comments on commit 7ade07c

Please sign in to comment.