Fix: NoneType error in normalize_will when others_inputs is None
When deleting old transactions and clicking Check, task_phase1 would fail with 'NoneType object has no attribute get' error in WillItem.normalize_locktime. Root cause: In Will.normalize_will (will.py:150), the parameter others_inputs defaults to None. At line 151, a local variable 'others_input' is created with a safe default value (empty dict). However, lines 179 and 184 still used the original 'others_inputs' parameter instead of the safe local variable, causing the error when calling .get() on None. Fix: Use the safe 'others_input' variable instead of the raw parameter in lines 179 and 184. Also added: - Traceback logging to on_error_phase1 so future errors include full call stack - Debug logging in update_all to log willitems state before processing - Comprehensive test (test_e5_build_with_real_wallet_heirs_and_utxos) that reproduces the exact scenario from the user's karen7 wallet
This commit is contained in:
@@ -860,6 +860,7 @@ class BalBuildWillDialog(BalDialog):
|
||||
|
||||
except Exception as e:
|
||||
self.msg_set_building(self.msg_error(e))
|
||||
raise e
|
||||
return False, None
|
||||
|
||||
# DUST report (one line PER HEIR, not per will-executor).
|
||||
@@ -1010,11 +1011,19 @@ class BalBuildWillDialog(BalDialog):
|
||||
)
|
||||
|
||||
def on_accept(self):
|
||||
self.bal_window.update_all()
|
||||
try:
|
||||
self.bal_window.update_all()
|
||||
except Exception as e:
|
||||
import traceback
|
||||
_logger.error(f"NoneType_catch on_accept: {e}\n{traceback.format_exc()}")
|
||||
pass
|
||||
|
||||
def on_accept_phase2(self):
|
||||
self.bal_window.update_all()
|
||||
try:
|
||||
self.bal_window.update_all()
|
||||
except Exception as e:
|
||||
import traceback
|
||||
_logger.error(f"NoneType_catch on_accept_phase2: {e}\n{traceback.format_exc()}")
|
||||
pass
|
||||
|
||||
def on_error_push(self):
|
||||
@@ -1265,6 +1274,13 @@ class BalBuildWillDialog(BalDialog):
|
||||
)
|
||||
|
||||
def on_success_phase1(self, result):
|
||||
try:
|
||||
self._on_success_phase1_body(result)
|
||||
except Exception as e:
|
||||
import traceback
|
||||
_logger.error(f"NoneType_catch on_success_phase1: {e}\n{traceback.format_exc()}")
|
||||
|
||||
def _on_success_phase1_body(self, result):
|
||||
if self._stopping:
|
||||
return
|
||||
self.have_to_sign, tx = list(result)
|
||||
@@ -1574,7 +1590,8 @@ class BalBuildWillDialog(BalDialog):
|
||||
self.bal_window.update_all()
|
||||
a, b, c = error
|
||||
self.msg_edit_row(self.msg_error(f"Error: {b}"))
|
||||
_logger.error(f"error phase1: {b}")
|
||||
import traceback
|
||||
_logger.error(f"error phase1: {b}\n{''.join(traceback.format_exception(a, b, c))}")
|
||||
button=QPushButton(_("Close"))
|
||||
button.clicked.connect(self.close)
|
||||
self.vbox.addWidget(button)
|
||||
|
||||
@@ -1352,6 +1352,9 @@ class BalWindow:
|
||||
# value and the invalidated/replaced rows would not appear/disappear
|
||||
# until Electrum was restarted.
|
||||
self.bal_plugin.sync_hide_filters()
|
||||
_logger.debug(f"NoneType_debug willitems type: {type(self.willitems).__name__} len={len(self.willitems)}")
|
||||
for _wid, _w in list(self.willitems.items())[:3]:
|
||||
_logger.debug(f"NoneType_debug willitems[{_wid}] type={type(_w).__name__}")
|
||||
Will.add_willtree(self.willitems)
|
||||
all_utxos = self.wallet.get_utxos()
|
||||
utxos_list = Will.utxos_strs(all_utxos)
|
||||
|
||||
Reference in New Issue
Block a user