commit 8e3ee73dafb15e8d8bce2d1e11470582597f69e8
parent 6aa337c618221acb1af700b8a6972914f8fa5949
Author: ThomasV <thomasv@electrum.org>
Date: Wed, 27 May 2020 18:37:04 +0200
Merge pull request #6134 from SomberNight/202004_ln_fundingtx_forbid_bump_cjoin
wallet: disallow fee-bumping/coinjoining ln funding tx
Diffstat:
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py
@@ -170,9 +170,9 @@ class BaseTxDialog(QDialog, MessageBoxMixin):
ptx_merge_sigs_action = QAction(_("Merge signatures from"), self)
ptx_merge_sigs_action.triggered.connect(self.merge_sigs)
partial_tx_actions_menu.addAction(ptx_merge_sigs_action)
- ptx_join_txs_action = QAction(_("Join inputs/outputs"), self)
- ptx_join_txs_action.triggered.connect(self.join_tx_with_another)
- partial_tx_actions_menu.addAction(ptx_join_txs_action)
+ self._ptx_join_txs_action = QAction(_("Join inputs/outputs"), self)
+ self._ptx_join_txs_action.triggered.connect(self.join_tx_with_another)
+ partial_tx_actions_menu.addAction(self._ptx_join_txs_action)
self.partial_tx_actions_button = QToolButton()
self.partial_tx_actions_button.setText(_("Combine"))
self.partial_tx_actions_button.setMenu(partial_tx_actions_menu)
@@ -499,6 +499,8 @@ class BaseTxDialog(QDialog, MessageBoxMixin):
widget.menuAction().setVisible(show_psbt_only_widgets)
else:
widget.setVisible(show_psbt_only_widgets)
+ if tx_details.is_lightning_funding_tx:
+ self._ptx_join_txs_action.setEnabled(False) # would change txid
self.save_button.setEnabled(tx_details.can_save_as_local)
if tx_details.can_save_as_local:
diff --git a/electrum/wallet.py b/electrum/wallet.py
@@ -208,6 +208,7 @@ class TxWalletDetails(NamedTuple):
tx_mined_status: TxMinedInfo
mempool_depth_bytes: Optional[int]
can_remove: bool # whether user should be allowed to delete tx
+ is_lightning_funding_tx: bool
class Abstract_Wallet(AddressSynchronizer, ABC):
@@ -521,7 +522,11 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
exp_n = None
can_broadcast = False
can_bump = False
- tx_hash = tx.txid()
+ tx_hash = tx.txid() # note: txid can be None! e.g. when called from GUI tx dialog
+ is_lightning_funding_tx = False
+ if self.has_lightning() and tx_hash is not None:
+ is_lightning_funding_tx = any([chan.funding_outpoint.txid == tx_hash
+ for chan in self.lnworker.channels.values()])
tx_we_already_have_in_db = self.db.get_transaction(tx_hash)
can_save_as_local = (is_relevant and tx.txid() is not None
and (tx_we_already_have_in_db is None or not tx_we_already_have_in_db.is_complete()))
@@ -571,6 +576,9 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
else:
amount = None
+ if is_lightning_funding_tx:
+ can_bump = False # would change txid
+
return TxWalletDetails(
txid=tx_hash,
status=status,
@@ -583,6 +591,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
tx_mined_status=tx_mined_status,
mempool_depth_bytes=exp_n,
can_remove=can_remove,
+ is_lightning_funding_tx=is_lightning_funding_tx,
)
def get_spendable_coins(self, domain, *, nonlocal_only=False) -> Sequence[PartialTxInput]: