From 9b354655e4b0858a90e0231c30490eb08a9d7de3 Mon Sep 17 00:00:00 2001 From: Hansie Odendaal <39146854+hansieodendaal@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:44:36 +0200 Subject: [PATCH] feat: clear out custom base node (#6746) Description --- Cleared out the old custom base node in the console wallet base node list in the network tab if another one is assigned. **Note:** Currently in the console wallet we only accept one custom base node, not a list. The new custom base node was added correctly and the old one removed from the database, the only issue here was that the Network tab display was not updated. Fixes #5353 Motivation and Context --- The old custom base node was not cleared from the list. How Has This Been Tested? --- System-level testing What process can a PR reviewer use to test or verify this change? --- Code review Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify Co-authored-by: SW van Heerden --- .../minotari_console_wallet/src/ui/state/app_state.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/applications/minotari_console_wallet/src/ui/state/app_state.rs b/applications/minotari_console_wallet/src/ui/state/app_state.rs index b392db494d..9c068f968d 100644 --- a/applications/minotari_console_wallet/src/ui/state/app_state.rs +++ b/applications/minotari_console_wallet/src/ui/state/app_state.rs @@ -1056,6 +1056,14 @@ impl AppStateInner { self.data.base_node_previous = self.data.base_node_selected.clone(); self.data.base_node_selected = peer.clone(); self.data.base_node_peer_custom = Some(peer.clone()); + if let Some(pos) = self + .data + .base_node_list + .iter() + .position(|(s, _)| s == "Custom Base Node") + { + self.data.base_node_list.remove(pos); + } self.data .base_node_list .insert(0, ("Custom Base Node".to_string(), peer.clone()));