From c27c3578140d4aa1147837cd26cd11114173326d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Papie=C5=BC?= Date: Wed, 8 Jan 2025 11:45:03 +0100 Subject: [PATCH 1/6] fix: require initial connected peer for wait synced --- src-tauri/src/node_adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/node_adapter.rs b/src-tauri/src/node_adapter.rs index 0479c4ccd..1c3fedcb1 100644 --- a/src-tauri/src/node_adapter.rs +++ b/src-tauri/src/node_adapter.rs @@ -468,7 +468,7 @@ impl MinotariNodeStatusMonitor { .map_err(|e| MinotariNodeStatusMonitorError::UnknownError(e.into()))?; let tip_res = tip.into_inner(); let sync_progress = sync_progress.into_inner(); - if tip_res.initial_sync_achieved { + if tip_res.initial_sync_achieved && sync_progress.initial_connected_peers > 0 { break Ok(()); } From 6c2fe9621e1719742f05196723a608074268ae74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Papie=C5=BC?= Date: Thu, 9 Jan 2025 11:08:28 +0100 Subject: [PATCH 2/6] Update node_adapter.rs --- src-tauri/src/node_adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/node_adapter.rs b/src-tauri/src/node_adapter.rs index 1c3fedcb1..aa1c33a3a 100644 --- a/src-tauri/src/node_adapter.rs +++ b/src-tauri/src/node_adapter.rs @@ -468,7 +468,7 @@ impl MinotariNodeStatusMonitor { .map_err(|e| MinotariNodeStatusMonitorError::UnknownError(e.into()))?; let tip_res = tip.into_inner(); let sync_progress = sync_progress.into_inner(); - if tip_res.initial_sync_achieved && sync_progress.initial_connected_peers > 0 { + if tip_res.initial_sync_achieved && sync_progress.initial_connected_peers > 1 { break Ok(()); } From 565cfc31b011fb52a6825d2654bf917eca68c9bc Mon Sep 17 00:00:00 2001 From: brianp Date: Fri, 10 Jan 2025 11:17:16 +0100 Subject: [PATCH 3/6] change required initial peer number --- src-tauri/src/node_adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/node_adapter.rs b/src-tauri/src/node_adapter.rs index aa1c33a3a..b82cf3730 100644 --- a/src-tauri/src/node_adapter.rs +++ b/src-tauri/src/node_adapter.rs @@ -70,7 +70,7 @@ impl MinotariNodeAdapter { grpc_port: port, tcp_listener_port, use_pruned_mode: false, - required_initial_peers: 3, + required_initial_peers: 2, use_tor: false, tor_control_port: None, latest_status_broadcast: status_broadcast, From 703dd4269bf50ae1ffdec608b8995903554f77d9 Mon Sep 17 00:00:00 2001 From: brianp Date: Fri, 10 Jan 2025 11:30:02 +0100 Subject: [PATCH 4/6] use config value --- src-tauri/src/node_adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/node_adapter.rs b/src-tauri/src/node_adapter.rs index b82cf3730..471792d28 100644 --- a/src-tauri/src/node_adapter.rs +++ b/src-tauri/src/node_adapter.rs @@ -468,7 +468,7 @@ impl MinotariNodeStatusMonitor { .map_err(|e| MinotariNodeStatusMonitorError::UnknownError(e.into()))?; let tip_res = tip.into_inner(); let sync_progress = sync_progress.into_inner(); - if tip_res.initial_sync_achieved && sync_progress.initial_connected_peers > 1 { + if tip_res.initial_sync_achieved && sync_progress.initial_connected_peers >= self.required_sync_peers as u64 { break Ok(()); } From 24a9b4fdc37f9248979af3c9f6aaf7202ce0cf92 Mon Sep 17 00:00:00 2001 From: brianp Date: Fri, 10 Jan 2025 12:37:52 +0100 Subject: [PATCH 5/6] cargo fmt --- src-tauri/src/node_adapter.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/node_adapter.rs b/src-tauri/src/node_adapter.rs index 471792d28..c82d018a7 100644 --- a/src-tauri/src/node_adapter.rs +++ b/src-tauri/src/node_adapter.rs @@ -468,7 +468,9 @@ impl MinotariNodeStatusMonitor { .map_err(|e| MinotariNodeStatusMonitorError::UnknownError(e.into()))?; let tip_res = tip.into_inner(); let sync_progress = sync_progress.into_inner(); - if tip_res.initial_sync_achieved && sync_progress.initial_connected_peers >= self.required_sync_peers as u64 { + if tip_res.initial_sync_achieved + && sync_progress.initial_connected_peers >= self.required_sync_peers as u64 + { break Ok(()); } From e9b28490b6fca17244ea4926b4a502bcf04a9fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Papie=C5=BC?= Date: Mon, 13 Jan 2025 11:49:50 +0100 Subject: [PATCH 6/6] require at least 1 peer to verify initial_sync_achieved validity --- src-tauri/src/node_adapter.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/node_adapter.rs b/src-tauri/src/node_adapter.rs index c82d018a7..1c3fedcb1 100644 --- a/src-tauri/src/node_adapter.rs +++ b/src-tauri/src/node_adapter.rs @@ -70,7 +70,7 @@ impl MinotariNodeAdapter { grpc_port: port, tcp_listener_port, use_pruned_mode: false, - required_initial_peers: 2, + required_initial_peers: 3, use_tor: false, tor_control_port: None, latest_status_broadcast: status_broadcast, @@ -468,9 +468,7 @@ impl MinotariNodeStatusMonitor { .map_err(|e| MinotariNodeStatusMonitorError::UnknownError(e.into()))?; let tip_res = tip.into_inner(); let sync_progress = sync_progress.into_inner(); - if tip_res.initial_sync_achieved - && sync_progress.initial_connected_peers >= self.required_sync_peers as u64 - { + if tip_res.initial_sync_achieved && sync_progress.initial_connected_peers > 0 { break Ok(()); }