qt: disable Submarine Payment tab if not swap_manager
What changed, and why it matters
This commit is a small hardening change in Electrum's Qt wallet interface. It hides the 'Submarine Payment' tab when the wallet does not have Lightning support (swap_manager is missing). Without this guard, the tab could be shown in a state where the underlying swap service is unavailable, which might lead to a confusing or broken user experience rather than a direct theft-of-funds bug.
No urgent action. Treat as routine hardening. If submarine payments are an experimental feature, ensure the feature flag and backend availability checks are consistently applied across all entry points.
Security signals we found
UI state guard added to prevent use of an uninitialized/None backend service
Feature flag gated behind additional capability check
Defensive null check for swap_manager
Evidence from the diff
In electrum/gui/qt/confirm_tx_dialog.py, the condition for allowing submarine swaps is tightened by adding and self.swap_manager. The previous condition only checked allow_preview and payee_outputs. If swap_manager is None (wallets without Lightning), the submarine payment tab would still be added when the feature flag is on, potentially exposing UI controls whose backend service is absent. The patch prevents that.
Changed components
electrum/gui/qt/confirm_tx_dialog.pySubmarine Payment tab in Qt send/confirm dialogInspect captured patch +2 / −1
diff --git a/electrum/gui/qt/confirm_tx_dialog.py b/electrum/gui/qt/confirm_tx_dialog.py
index 3961c09..5549d7e 100644
--- a/electrum/gui/qt/confirm_tx_dialog.py
+++ b/electrum/gui/qt/confirm_tx_dialog.py
@@ -303,7 +303,8 @@ class TxEditor(WindowModalDialog, QtEventListener, Logger):
# always show onchain payment tab
self.tab_widget.addTab(self.onchain_tab, _('Onchain Transaction'))
- allow_swaps = self.allow_preview and self.payee_outputs # allow_preview is false for ln channel opening txs
+ # allow_preview is false for ln channel opening txs
+ allow_swaps = self.allow_preview and self.payee_outputs and self.swap_manager
if self.config.WALLET_ENABLE_SUBMARINE_PAYMENTS and allow_swaps:
i = self.tab_widget.addTab(self.submarine_payment_tab, _('Submarine Payment'))
tooltip = self.config.cv.WALLET_ENABLE_SUBMARINE_PAYMENTS.get_long_desc()
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.