From dc19296804edbfddf494bb59c1d0438cbf98db0b Mon Sep 17 00:00:00 2001 From: Janez T Date: Fri, 13 Mar 2026 18:48:17 +0100 Subject: [PATCH] Fix channel overwrite bug --- lib/providers/connection_provider.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/providers/connection_provider.dart b/lib/providers/connection_provider.dart index 6516c3c..b61458f 100644 --- a/lib/providers/connection_provider.dart +++ b/lib/providers/connection_provider.dart @@ -874,8 +874,13 @@ class ConnectionProvider with ChangeNotifier { } } - // If still no info, assume it's empty - return true; + // If we still have no authoritative answer after an on-device query, + // treat the slot as occupied/unknown so we never overwrite a channel + // because of stale or delayed state propagation. + debugPrint( + ' ⚠️ Slot $channelIdx state is still unknown after query; refusing to treat it as empty', + ); + return false; } catch (e) { debugPrint('❌ [Provider] Failed to check slot $channelIdx: $e'); if (_isEmptyChannelQueryError(e)) {