Browse Source

Merge pull request #6134 from SomberNight/202004_ln_fundingtx_forbid_bump_cjoin

wallet: disallow fee-bumping/coinjoining ln funding tx
master
ThomasV 4 years ago
committed by GitHub
parent
commit
8e3ee73daf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      electrum/gui/qt/transaction_dialog.py
  2. 11
      electrum/wallet.py

8
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:

11
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]:

Loading…
Cancel
Save