core+gui: name the real cause of a failed build instead of guessing #7
Reference in New Issue
Block a user
Delete Branch "ui/build-will-error-messages"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Building Will report showed a fixed list of three "possible reasons"
whenever a build produced nothing, regardless of what actually happened; in a
case reproduced from the owner log all three were false and the real cause was
not even listed. The "Checking your will" row had the same flaw, showing one
sentence ("Found CHANGES to the DATE or the HEIRS") for five situations,
including one where it is plainly wrong (funds received).
core/heirs.py: record WHY buildTransactions gave up in a new last_build_error
attribute (8 reason codes), set at each path that previously returned empty
with no explanation, plus a processed_willexecutors counter to tell "every
will-executor was skipped" apart from "we tried and failed". Also fix a latent
crash in the prepare_transactions handler, which read a no-longer-existing
e.heirname attribute and re-raised the resulting AttributeError, masking the
real error.
gui/qt/dialogs.py: add msg_alert() (amber warning sign, body text in the theme
colour, readable in both themes), _build_failure_message() and
_check_failure_message() to turn those causes into one precise sentence each,
with an honest "cause could not be determined" fallback. Catch
BalanceTooLowException, which already carried the figures but fell through to
the generic red technical error.
No new exception classes were introduced (owner request): the plain
NotCompleteWillException cases are told apart structurally, not by text.
Name the real cause of a failed build instead of guessing
Why
The Building Will report had two problems the owner hit in practice:
which made it hard to read.
three "possible reasons" (low balance / dust shares / check-alive later
than the delivery date) regardless of what actually happened. In a case
reproduced from the owner's Electrum log all three were false, and the
real cause (no delivery date left to build) was not even in the list.
"Found CHANGES to the DATE or the HEIRS" was shown for five different
situations — including one where it is plainly wrong (funds received, where
neither the date nor the heirs changed).
What this does
bal/core/heirs.pyHeirs.last_build_error, recording whybuildTransactionsproduced notransaction. Reset at the start of every build and set at each path that
previously returned empty with no explanation:
NO_HEIRS,NO_UTXO,NO_WILLEXECUTOR_USABLE,NO_FUTURE_DATE,WILLEXECUTOR_FEE,WILLEXECUTOR_FEE_TOO_HIGH,TX_BUILD_FAILED,WILLEXECUTOR_TX_ERROR.processed_willexecutorscounter, so "every will-executor was skipped"(which returned silently, with no log line at all) is told apart from "we
tried and the build failed".
prepare_transactionsexception handler reade.heirnameto auto-deselect the offending will-executor, but nothing in the plugin sets
that attribute any more. The lookup raised
AttributeError, and the innerexcept Exception: raisere-raised that, aborting the whole build with aconfusing secondary error. It now records the reason, logs the real
exception with the will-executor URL, and moves on to the next one.
bal/gui/qt/dialogs.pymsg_alert()— amber warning sign, body text in the theme's defaultcolour. Colour attracts attention, it is not what gets read, so it stays on
the sign alone; this also keeps the text readable under the dark theme,
where a hard-coded black would disappear.
_build_failure_message()and_check_failure_message()— turn thecauses above into one precise sentence each, with an honest "the exact cause
could not be determined" fallback rather than three guesses.
except BalanceTooLowExceptionhandler — the exception already carriedbalance, fees and dust threshold, but fell through to the generic handler
which printed the raw technical string in red and re-raised.
No Heirsuses the new style; "Check Alive ThresholdPassed" deliberately stays red, being the more urgent case (owner
request).
bal/gui/qt/common.py— re-exportBalanceTooLowException.No new exception classes were introduced (owner request): the two plain
NotCompleteWillExceptioncases are told apart structurally (raised with noargument vs. with one), not by matching message text.
Verification
py_compileclean on all 44 files of the package.msg_alert,_build_failure_messageand_check_failure_messagewereextracted from the source via AST and executed against every reason code and
every exception type, with the exception hierarchy rebuilt from
will.py:9 build cases and 8 check cases all produce the intended text.
has no importable
electrummodule.NO_FUTURE_DATE,WILLEXECUTOR_FEEandNo Heirsall confirmed on screen.Merge notes
main(no conflicts).feature/bal-qr-transferthere is one trivial conflict, inCHANGELOG.mdonly — both branches append an entry at the end of the file.This branch deliberately numbers its entry 57, since the QR branch uses
56, so the resolution is simply to keep both in order.
bal/gui/qt/dialogs.pymerges cleanly with the QR branch, including theimport list.
bal/core/will.py, so it does not interfere with thein-progress RLock /
cannot pickle '_thread.RLock' objectfix.The Building Will report showed a fixed list of three "possible reasons" whenever a build produced nothing, regardless of what actually happened; in a case reproduced from the owner log all three were false and the real cause was not even listed. The "Checking your will" row had the same flaw, showing one sentence ("Found CHANGES to the DATE or the HEIRS") for five situations, including one where it is plainly wrong (funds received). core/heirs.py: record WHY buildTransactions gave up in a new last_build_error attribute (8 reason codes), set at each path that previously returned empty with no explanation, plus a processed_willexecutors counter to tell "every will-executor was skipped" apart from "we tried and failed". Also fix a latent crash in the prepare_transactions handler, which read a no-longer-existing e.heirname attribute and re-raised the resulting AttributeError, masking the real error. gui/qt/dialogs.py: add msg_alert() (amber warning sign, body text in the theme colour, readable in both themes), _build_failure_message() and _check_failure_message() to turn those causes into one precise sentence each, with an honest "cause could not be determined" fallback. Catch BalanceTooLowException, which already carried the figures but fell through to the generic red technical error. No new exception classes were introduced (owner request): the plain NotCompleteWillException cases are told apart structurally, not by text.