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:
@@ -348,17 +348,15 @@ class TxDialog(Factory.Popup):
|
||||
|
||||
def remove_local_tx(self):
|
||||
txid = self.tx.txid()
|
||||
to_delete = {txid}
|
||||
to_delete |= self.wallet.get_depending_transactions(txid)
|
||||
num_child_txs = len(self.wallet.get_depending_transactions(txid))
|
||||
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))
|
||||
|
||||
def on_prompt(b):
|
||||
if b:
|
||||
for tx in to_delete:
|
||||
self.wallet.remove_transaction(tx)
|
||||
self.wallet.remove_transaction(txid)
|
||||
self.wallet.save_db()
|
||||
self.app._trigger_update_wallet() # FIXME private...
|
||||
self.dismiss()
|
||||
|
||||
Reference in New Issue
Block a user