From 9e119068fa306d5c6eb48c95a62696907e4a6d48 Mon Sep 17 00:00:00 2001 From: oars Date: Wed, 13 Aug 2025 18:17:50 +0300 Subject: [PATCH] bin/lilith: DEP-0006: manually add app identifier for each p2p network in lilith config --- bin/lilith/lilith_config.toml | 3 +++ bin/lilith/src/main.rs | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/bin/lilith/lilith_config.toml b/bin/lilith/lilith_config.toml index 23f0abd56..7ac1ccc54 100644 --- a/bin/lilith/lilith_config.toml +++ b/bin/lilith/lilith_config.toml @@ -20,6 +20,7 @@ rpc_listen = "tcp://127.0.0.1:18927" #seeds = [] #peers = [] #version = "0.5.0" +#app_name = "darkfid" #localnet = false #hostlist ="~/.local/share/darkfi/lilith/darkfid_sync/hostlist.tsv" #datastore = "~/.local/share/darkfi/lilith/darkfid_sync" @@ -30,6 +31,7 @@ rpc_listen = "tcp://127.0.0.1:18927" #seeds = [] #peers = [] #version = "0.5.1" +#app_name = "darkirc" #localnet = false #datastore = "~/.local/share/darkfi/lilith/darkirc" #hostlist ="~/.local/share/darkfi/lilith/darkirc/hostlist.tsv" @@ -40,6 +42,7 @@ rpc_listen = "tcp://127.0.0.1:18927" #seeds = [] #peers = [] #version = "0.5.0" +#app_name = "taud" #localnet = false #datastore = "~/.local/share/darkfi/lilith/taud" #hostlist ="~/.local/share/darkfi/lilith/taud/hostlist.tsv" diff --git a/bin/lilith/src/main.rs b/bin/lilith/src/main.rs index c565575ab..4eb65c593 100644 --- a/bin/lilith/src/main.rs +++ b/bin/lilith/src/main.rs @@ -149,6 +149,8 @@ struct NetInfo { pub peers: Vec, /// Supported network version pub version: Version, + /// App Identifier for the app running on the network + pub app_name: String, /// Enable localnet hosts pub localnet: bool, /// Path to P2P datastore @@ -328,6 +330,12 @@ fn parse_configured_networks(data: &str) -> Result> { semver::Version::parse(option_env!("CARGO_PKG_VERSION").unwrap_or("0.0.0"))? }; + let app_name = if table.contains_key("app_name") { + table["app_name"].as_str().unwrap().to_string() + } else { + String::new() + }; + let datastore: String = table["datastore"].as_str().unwrap().to_string(); let hostlist: String = table["hostlist"].as_str().unwrap().to_string(); @@ -346,6 +354,7 @@ fn parse_configured_networks(data: &str) -> Result> { seeds, peers, version, + app_name, localnet, datastore, hostlist, @@ -377,6 +386,7 @@ async fn spawn_net(name: String, info: &NetInfo, ex: Arc>) -> outbound_connect_timeout: 30, inbound_connections: 512, app_version: info.version.clone(), + app_name: info.app_name.clone(), localnet: info.localnet, p2p_datastore: Some(info.datastore.clone()), hostlist: Some(info.hostlist.clone()),