mirror of
https://github.com/ratspeak/rsLXMF
synced 2026-11-22 23:10:35 +00:00
lxmf: drop inert enforce_ratchets knob for Python lxmd parity
This commit is contained in:
1 parent
b08de427a9
commit
b99c177f01
4 files changed
+16
-15
No files matched your search
@@ -264,7 +264,7 @@ Supported sections:
|
||||
| Section | Keys |
|
||||
| --- | --- |
|
||||
| `[lxmf]` | `display_name`, `announce_at_start`, `announce_interval`, `delivery_transfer_max_accepted_size`, `stamp_cost`, `on_inbound` |
|
||||
| `[propagation]` | `enable_node`, `node_name`, `auth_required`, `announce_at_start`, `announce_interval`, `autopeer`, `autopeer_maxdepth`, `message_storage_limit`, `propagation_message_max_accepted_size`, `propagation_sync_max_accepted_size`, `propagation_stamp_cost_target`, `propagation_stamp_cost_flexibility`, `peering_cost`, `remote_peering_cost_max`, `max_peers`, `static_peers`, `prioritise_destinations`, `control_allowed`, `from_static_only`, `outbound_node`, `propagation_stamp_cost`, `propagation_limit`, `enforce_ratchets`, `enforce_stamps` |
|
||||
| `[propagation]` | `enable_node`, `node_name`, `auth_required`, `announce_at_start`, `announce_interval`, `autopeer`, `autopeer_maxdepth`, `message_storage_limit`, `propagation_message_max_accepted_size`, `propagation_sync_max_accepted_size`, `propagation_stamp_cost_target`, `propagation_stamp_cost_flexibility`, `peering_cost`, `remote_peering_cost_max`, `max_peers`, `static_peers`, `prioritise_destinations`, `control_allowed`, `from_static_only`, `outbound_node`, `propagation_stamp_cost`, `propagation_limit`, `enforce_stamps` |
|
||||
| `[control]` | `auth_required`, `allowed` |
|
||||
| `[logging]` | `loglevel` |
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ pub struct RouterConfigExt {
|
||||
pub processing_outbound: bool,
|
||||
/// Maximum outbound messages to process per tick (`None` = unlimited).
|
||||
pub processing_limit: Option<usize>,
|
||||
pub enforce_ratchets: bool,
|
||||
pub enforce_stamps: bool,
|
||||
pub retain_synced_on_node: bool,
|
||||
pub auth_required: bool,
|
||||
@@ -69,7 +68,6 @@ impl Default for RouterConfigExt {
|
||||
max_peering_cost: MAX_PEERING_COST,
|
||||
processing_outbound: true,
|
||||
processing_limit: None,
|
||||
enforce_ratchets: false,
|
||||
enforce_stamps: false,
|
||||
retain_synced_on_node: false,
|
||||
auth_required: false,
|
||||
@@ -1111,10 +1109,6 @@ impl LxmRouter {
|
||||
self.config.propagation_stamp_flex = flex;
|
||||
}
|
||||
|
||||
pub fn set_enforce_ratchets(&mut self, enforce: bool) {
|
||||
self.config.ext.enforce_ratchets = enforce;
|
||||
}
|
||||
|
||||
pub fn set_enforce_stamps(&mut self, enforce: bool) {
|
||||
self.config.ext.enforce_stamps = enforce;
|
||||
}
|
||||
@@ -1949,7 +1943,6 @@ mod tests {
|
||||
assert!(config.ext.processing_outbound);
|
||||
assert!(config.ext.defer_stamp_generation);
|
||||
assert!(config.ext.processing_limit.is_none());
|
||||
assert!(!config.ext.enforce_ratchets);
|
||||
assert!(!config.ext.enforce_stamps);
|
||||
}
|
||||
|
||||
|
||||
@@ -1048,9 +1048,6 @@ impl LxmdRunner {
|
||||
self.router.set_stamp_cost(self.lxmf_dest_hash, cost);
|
||||
}
|
||||
|
||||
if self.config.enforce_ratchets {
|
||||
self.router.set_enforce_ratchets(true);
|
||||
}
|
||||
if self.config.enforce_stamps {
|
||||
self.router.set_enforce_stamps(true);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,6 @@ pub struct DaemonConfig {
|
||||
pub control_allowed: Vec<String>,
|
||||
pub static_peers: Vec<String>,
|
||||
pub prioritise_destinations: Vec<String>,
|
||||
pub enforce_ratchets: bool,
|
||||
pub enforce_stamps: bool,
|
||||
pub message_storage_limit: Option<usize>,
|
||||
pub from_static_only: bool,
|
||||
@@ -196,7 +195,6 @@ impl Default for DaemonConfig {
|
||||
control_allowed: Vec::new(),
|
||||
static_peers: Vec::new(),
|
||||
prioritise_destinations: Vec::new(),
|
||||
enforce_ratchets: false,
|
||||
enforce_stamps: false,
|
||||
message_storage_limit: Some(500_000_000),
|
||||
from_static_only: false,
|
||||
@@ -221,7 +219,6 @@ impl DaemonConfig {
|
||||
autopeer_maxdepth: self.autopeer_maxdepth,
|
||||
peering_cost: self.peering_cost,
|
||||
max_peering_cost: self.max_peering_cost,
|
||||
enforce_ratchets: self.enforce_ratchets,
|
||||
enforce_stamps: self.enforce_stamps,
|
||||
auth_required: self.auth_required,
|
||||
message_storage_limit: self.message_storage_limit,
|
||||
@@ -301,7 +298,6 @@ impl DaemonConfig {
|
||||
{
|
||||
dc.propagation_limit_kb = limit as usize;
|
||||
}
|
||||
dc.enforce_ratchets = sec.get_bool_or("enforce_ratchets", false);
|
||||
dc.enforce_stamps = sec.get_bool_or("enforce_stamps", false);
|
||||
}
|
||||
|
||||
@@ -654,4 +650,19 @@ propagation_stamp_cost = 19
|
||||
assert_eq!(dc.propagation_stamp_cost, 19);
|
||||
assert_eq!(dc.to_router_config().propagation_stamp_cost, 19);
|
||||
}
|
||||
|
||||
/// Python lxmd exposes no enforce_ratchets option; the key must parse as a no-op.
|
||||
#[test]
|
||||
fn test_enforce_ratchets_key_ignored_matching_python_lxmd() {
|
||||
let input = r#"
|
||||
[propagation]
|
||||
enforce_ratchets = yes
|
||||
enforce_stamps = yes
|
||||
"#;
|
||||
let config = rns_runtime::config::Config::parse(input).unwrap();
|
||||
let dc = DaemonConfig::from_config(&config);
|
||||
|
||||
assert!(dc.enforce_stamps);
|
||||
assert!(dc.to_router_config().ext.enforce_stamps);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user