mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
Merge pull request #6134 from SomberNight/202004_ln_fundingtx_forbid_bump_cjoin
wallet: disallow fee-bumping/coinjoining ln funding tx
This commit is contained in:
commit
8e3ee73daf
2 changed files with 15 additions and 4 deletions
|
@ -170,9 +170,9 @@ class BaseTxDialog(QDialog, MessageBoxMixin):
|
||||||
ptx_merge_sigs_action = QAction(_("Merge signatures from"), self)
|
ptx_merge_sigs_action = QAction(_("Merge signatures from"), self)
|
||||||
ptx_merge_sigs_action.triggered.connect(self.merge_sigs)
|
ptx_merge_sigs_action.triggered.connect(self.merge_sigs)
|
||||||
partial_tx_actions_menu.addAction(ptx_merge_sigs_action)
|
partial_tx_actions_menu.addAction(ptx_merge_sigs_action)
|
||||||
ptx_join_txs_action = QAction(_("Join inputs/outputs"), self)
|
self._ptx_join_txs_action = QAction(_("Join inputs/outputs"), self)
|
||||||
ptx_join_txs_action.triggered.connect(self.join_tx_with_another)
|
self._ptx_join_txs_action.triggered.connect(self.join_tx_with_another)
|
||||||
partial_tx_actions_menu.addAction(ptx_join_txs_action)
|
partial_tx_actions_menu.addAction(self._ptx_join_txs_action)
|
||||||
self.partial_tx_actions_button = QToolButton()
|
self.partial_tx_actions_button = QToolButton()
|
||||||
self.partial_tx_actions_button.setText(_("Combine"))
|
self.partial_tx_actions_button.setText(_("Combine"))
|
||||||
self.partial_tx_actions_button.setMenu(partial_tx_actions_menu)
|
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)
|
widget.menuAction().setVisible(show_psbt_only_widgets)
|
||||||
else:
|
else:
|
||||||
widget.setVisible(show_psbt_only_widgets)
|
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)
|
self.save_button.setEnabled(tx_details.can_save_as_local)
|
||||||
if tx_details.can_save_as_local:
|
if tx_details.can_save_as_local:
|
||||||
|
|
|
@ -208,6 +208,7 @@ class TxWalletDetails(NamedTuple):
|
||||||
tx_mined_status: TxMinedInfo
|
tx_mined_status: TxMinedInfo
|
||||||
mempool_depth_bytes: Optional[int]
|
mempool_depth_bytes: Optional[int]
|
||||||
can_remove: bool # whether user should be allowed to delete tx
|
can_remove: bool # whether user should be allowed to delete tx
|
||||||
|
is_lightning_funding_tx: bool
|
||||||
|
|
||||||
|
|
||||||
class Abstract_Wallet(AddressSynchronizer, ABC):
|
class Abstract_Wallet(AddressSynchronizer, ABC):
|
||||||
|
@ -521,7 +522,11 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
||||||
exp_n = None
|
exp_n = None
|
||||||
can_broadcast = False
|
can_broadcast = False
|
||||||
can_bump = 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)
|
tx_we_already_have_in_db = self.db.get_transaction(tx_hash)
|
||||||
can_save_as_local = (is_relevant and tx.txid() is not None
|
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()))
|
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:
|
else:
|
||||||
amount = None
|
amount = None
|
||||||
|
|
||||||
|
if is_lightning_funding_tx:
|
||||||
|
can_bump = False # would change txid
|
||||||
|
|
||||||
return TxWalletDetails(
|
return TxWalletDetails(
|
||||||
txid=tx_hash,
|
txid=tx_hash,
|
||||||
status=status,
|
status=status,
|
||||||
|
@ -583,6 +591,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
||||||
tx_mined_status=tx_mined_status,
|
tx_mined_status=tx_mined_status,
|
||||||
mempool_depth_bytes=exp_n,
|
mempool_depth_bytes=exp_n,
|
||||||
can_remove=can_remove,
|
can_remove=can_remove,
|
||||||
|
is_lightning_funding_tx=is_lightning_funding_tx,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_spendable_coins(self, domain, *, nonlocal_only=False) -> Sequence[PartialTxInput]:
|
def get_spendable_coins(self, domain, *, nonlocal_only=False) -> Sequence[PartialTxInput]:
|
||||||
|
|
Loading…
Add table
Reference in a new issue