qt: prevent setting locktime on channel funding tx
What changed, and why it matters
This commit removes the ability for users to manually set a transaction locktime when creating a Lightning channel funding transaction in Electrum's Qt desktop GUI. A locktime can delay when a transaction becomes valid or spendable. For channel funding transactions, allowing users to tweak this setting could lead to funds being stuck or channel setup failing, so the developers are treating it as a 'footgun'—a feature that is more likely to harm the user than help them. It is a UI restriction, not a fix for an active exploit.
No urgent action required. This is a defensive UX improvement. Users should keep Electrum updated. Developers should consider whether locktime restrictions should also be enforced at the wallet/protocol layer, not only in the Qt GUI, to ensure consistency across all interfaces.
Security signals we found
UI hardening: removes a potentially dangerous user-configurable option for a specific transaction type
Context-aware restriction based on TxEditorContext.CHANNEL_FUNDING
Commit message describes change as preventing a 'potential footgun' rather than a vulnerability
Evidence from the diff
The change in electrum/gui/qt/confirm_tx_dialog.py hides the locktime editor preference and locktime input fields when the transaction editor is in the TxEditorContext.CHANNEL_FUNDING context. Previously, the GUI exposed the locktime setting for all transactions, including channel funding transactions. The patch adds a context check so the preference menu item is not added and the locktime widgets are not shown for channel funding transactions. This prevents users from setting nLockTime on channel funding transactions via the Qt interface.
Changed components
electrum/gui/qt/confirm_tx_dialog.pyQt transaction editor locktime UI controlsLightning channel funding workflowInspect captured patch +3 / −2
diff --git a/electrum/gui/qt/confirm_tx_dialog.py b/electrum/gui/qt/confirm_tx_dialog.py
index dec7077..881c981 100644
--- a/electrum/gui/qt/confirm_tx_dialog.py
+++ b/electrum/gui/qt/confirm_tx_dialog.py
@@ -506,7 +506,8 @@ class TxEditor(WindowModalDialog, SubmarineSwapMixin, Logger):
def cb():
self.set_locktime_visible()
self.resize_to_fit_content()
- self.pref_menu.addConfig(self.config.cv.GUI_QT_TX_EDITOR_SHOW_LOCKTIME, callback=cb)
+ if self.context != TxEditorContext.CHANNEL_FUNDING:
+ self.pref_menu.addConfig(self.config.cv.GUI_QT_TX_EDITOR_SHOW_LOCKTIME, callback=cb)
self.pref_menu.addSeparator()
can_have_lightning = self.wallet.can_have_lightning()
send_ch_to_ln = self.pref_menu.addConfig(
@@ -590,7 +591,7 @@ class TxEditor(WindowModalDialog, SubmarineSwapMixin, Logger):
w.show()
def set_locktime_visible(self):
- b = self.config.GUI_QT_TX_EDITOR_SHOW_LOCKTIME
+ b = self.config.GUI_QT_TX_EDITOR_SHOW_LOCKTIME and self.context != TxEditorContext.CHANNEL_FUNDING
for w in [
self.locktime_e,
self.locktime_label]:
Why this scored 27/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.