1
0

wallet.remove_transaction: also rm dependent/child txs

Main motivation is that I often use wallet.remove_transaction
from the Qt console, and would find this behaviour more intuitive.
Note that previously if one were to call this on a tx with children,
the crash reporter would appear with "wallet.get_history() failed balance sanity-check".

related: https://github.com/spesmilo/electrum/issues/6960#issuecomment-764716533
This commit is contained in:
SomberNight
2021-01-21 18:05:48 +01:00
parent 4f3a28b87e
commit c4e9afa019
4 changed files with 23 additions and 21 deletions

View File

@@ -710,17 +710,15 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
menu.exec_(self.viewport().mapToGlobal(position))
def remove_local_tx(self, tx_hash: str):
to_delete = {tx_hash}
to_delete |= self.wallet.get_depending_transactions(tx_hash)
num_child_txs = len(self.wallet.get_depending_transactions(tx_hash))
question = _("Are you sure you want to remove this transaction?")
if len(to_delete) > 1:
if num_child_txs > 0:
question = (_("Are you sure you want to remove this transaction and {} child transactions?")
.format(len(to_delete) - 1))
.format(num_child_txs))
if not self.parent.question(msg=question,
title=_("Please confirm")):
return
for tx in to_delete:
self.wallet.remove_transaction(tx)
self.wallet.remove_transaction(tx_hash)
self.wallet.save_db()
# need to update at least: history_list, utxo_list, address_list
self.parent.need_update.set()