From 9204c90e4ce2138ba3825fa5bd221acf6f3a6c45 Mon Sep 17 00:00:00 2001 From: svatantrya Date: Wed, 15 Apr 2026 13:08:59 -0400 Subject: [PATCH] WillException.init bug --- bal.py | 1 + heirs.py | 4 +--- qt.py | 23 ++++++++++------------- will.py | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/bal.py b/bal.py index c906fd5..b5e415f 100644 --- a/bal.py +++ b/bal.py @@ -9,6 +9,7 @@ from electrum.plugin import BasePlugin from electrum.transaction import tx_from_any +_logger = get_logger(__name__) def get_will_settings(x): # print(x) pass diff --git a/heirs.py b/heirs.py index e8cc3aa..af6c7e8 100644 --- a/heirs.py +++ b/heirs.py @@ -30,11 +30,9 @@ from electrum.transaction import ( PartialTransaction, PartialTxInput, PartialTxOutput, - TxOutput, TxOutpoint, # TxOutput, ) -from electrum.payment_identifier import PaymentIdentifier from electrum.util import ( bfh, read_json_file, @@ -184,7 +182,7 @@ def prepare_transactions(locktimes, available_utxos, fees, wallet): tx.remove_signatures() txid = tx.txid() if txid is None: - raise Exception("txid is none", tx) + raise Exception(f"txid is none: {tx}") tx.heirs = paid_heirs tx.my_locktime = locktime diff --git a/qt.py b/qt.py index b4ffbcb..0a31250 100644 --- a/qt.py +++ b/qt.py @@ -15,14 +15,12 @@ from datetime import datetime from decimal import Decimal from functools import partial from typing import TYPE_CHECKING, Any, Callable, Mapping, Optional, Union -import traceback try: QT_VERSION = sys._GUI_QT_VERSION except Exception: QT_VERSION = 6 if QT_VERSION == 5: - from PyQt5.QtCore import QThread, QCoreApplication from PyQt5.QtCore import ( QDateTime, QModelIndex, @@ -58,7 +56,6 @@ if QT_VERSION == 5: QWidget, ) else: # QT6 - from PyQt6.QtCore import QThread, QCoreApplication from PyQt6.QtCore import ( QDateTime, QModelIndex, @@ -745,7 +742,7 @@ class BalWindow(Logger): self.bal_plugin.WILL_SETTINGS.set(self.will_settings) try: self.heir_list_widget.heir_locktime.set_locktime(locktime) - except Exception as e: + except Exception: pass #self.preview_list.heirs_locktime.set_locktim(will_settings['thershold']) @@ -758,11 +755,11 @@ class BalWindow(Logger): self.bal_plugin.WILL_SETTINGS.set(self.will_settings) try: self.heir_list_widget.heir_threshold.set_locktime(threshold) - except Exception as e: + except Exception: pass try: self.will_list.heir_threshold.set_locktime(threshold) - except Exception as e: + except Exception: pass def init_heirs_to_locktime(self, multiverse=False): @@ -1068,7 +1065,7 @@ class BalWindow(Logger): a,b,c = err self.logger.error(f"fail to broadcast transactions:{err}") self.logger.error(f"error: {b}") - self.logger.error(f"traceback ") + self.logger.error("traceback ") tb = c while tb is not None: frame = tb.tb_frame @@ -1238,11 +1235,11 @@ class BalWindow(Logger): # del self.waiting_dialog try: parent.will_executor_list_widget.update() - except Exception as e: + except Exception: pass try: parent.willexecutors_list.update() - except Exception as e: + except Exception: pass def on_failure(e): @@ -1349,7 +1346,7 @@ class HeirsLockTimeEdit(QWidget, _LockTimeEditor): for w in self.editors: w.setVisible(False) w.setEnabled(False) - prev_locktime = self.editor.get_locktime() + #prev_locktime = self.editor.get_locktime() self.editor = self.option_index_to_editor_map[i] #if self.editor.is_acceptable_locktime(prev_locktime): # self.editor.set_locktime(prev_locktime, force=False) @@ -1369,7 +1366,7 @@ class HeirsLockTimeEdit(QWidget, _LockTimeEditor): try: int(x) self.set_index(1) - except: + except Exception: if isinstance(x,str): self.set_index(0) self.editor.set_locktime(x, force=False) @@ -2468,7 +2465,7 @@ class BalBuildWillDialog(BalDialog): self.msg_set_pushing(self.msg_ok()) except Exception as e: - td = traceback.format_exc() + #td = traceback.format_exc() self.msg_set_pushing(self.msg_error(e)) self.msg_edit_row(self.msg_ok()) self.wait(5) @@ -2539,7 +2536,7 @@ class BalBuildWillDialog(BalDialog): def msg_edit_row(self, line, row=None): try: self.labels[row] = line - except Exception as e: + except Exception: self.labels.append(line) row = len(self.labels) - 1 diff --git a/will.py b/will.py index 0394e9f..fcc8b61 100644 --- a/will.py +++ b/will.py @@ -596,7 +596,7 @@ class Will: for wid in Will.only_valid_list(will): w = will[wid] if w.tx_fees != tx_fees: - raise TxFeesChangedException(f"{tx_fees}:", w.tx_fees) + raise TxFeesChangedException(f"{tx_fees}: {w.tx_fees}") for wheir in w.heirs: if not 'w!ll3x3c"' == wheir[:9]: their = will[wid].heirs[wheir]