feat(bal): Group A (timestamps + statuses + anticipate docs) and Group B (auto-sign) v0.3.4

Bump plugin version to 0.3.4 (manifest, __init__, plugin_base, VERSION).

GROUP A
- A1: remove block-height locktimes; the plugin now uses UNIX timestamps
  only. The NLOCKTIME_BLOCKHEIGHT_MAX guard is kept on purpose (it forces
  every locktime to be a timestamp). chk_locktime is now 2-arg; int_locktime
  and anticipate_locktime no longer accept blocks; RAW input only accepts d/y.
  Two now-dormant configs (LOCKTIME_BLOCKS, LOCKTIMEDELTA_BLOCKS) are kept with
  comments to avoid touching persisted keys.
- A2: rename PENDING -> MEMPOOL everywhere (label 'Mempool', yellow #ffce30);
  add new UPDATED status; ANTICIPATED & UPDATED keep VALID; documented
  set_status rules; backward-compat migration (old PENDING -> MEMPOOL).
- A3: clarify that anticipating to a future date only rebuilds (never
  invalidates), while only a past locktime invalidates (WillExpired). Code was
  already correct; only the comment and docs were fixed.

Colour follow-up: UPDATED lightened from #800080 to #b266b2 (more readable),
updated in theme.py, docs and the theme test.

GROUP B
- B1: verified the 'Create your will' button already opens the guided wizard
  (no code change needed).
- B2: new persisted AUTO_SIGN setting (default ON) with an 'Auto-sign on Check'
  checkbox in the settings dialog. When enabled, Check signs and broadcasts
  automatically; the wallet password is requested only for encrypted wallets.

B2 follow-up (fixes reported after testing):
- Remove the duplicate sign/broadcast cycle in lists.check(); build_will_task()
  already signs and broadcasts.
- Suppress the manual 'press Sign/Broadcast' hint and its popup when AUTO_SIGN
  is ON (kept when OFF).
- Make broadcast one-shot: removed the retry flag and the Exception('retry');
  failed will-executors stay PUSH_FAIL and are skipped (no endless retry).
  PUSHED transactions are already excluded from re-collection.

Docs: inheritance-options.md/.html and inheritance-flow.svg updated to v0.3.4.
Tests: 206 passing (new test_anticipate_manual_locktime, test_anticipate_past_locktime,
test_group_b_auto_sign; updated core/util, core/will_extra, gui/theme, gui/widgets).
CHANGELOG.md added with one numbered entry per task.
This commit is contained in:
2026-06-28 23:00:23 -04:00
parent 10d0b85779
commit dc166d04ff
23 changed files with 1374 additions and 205 deletions

View File

@@ -96,7 +96,9 @@ def test_check_invalidated_confirmed():
assert item.get_status("CONFIRMED") is True
def test_check_invalidated_pending():
def test_check_invalidated_mempool():
# PENDING was renamed to MEMPOOL (A2): a tx seen with height 0 (in the
# mempool, not yet mined) is flagged as MEMPOOL.
wallet = MagicMock()
wallet.get_tx_info.return_value.tx_mined_status.height.return_value = 0
item = WillItem({"tx": _VALID_TX_HEX, "heirs": {"a": ["addr", 100, "30d"]},
@@ -104,7 +106,65 @@ def test_check_invalidated_pending():
"time": 0, "change": "", "baltx_fees": 100})
will = {"wid": item}
Will.check_invalidated(will, [], wallet)
assert item.get_status("PENDING") is True
assert item.get_status("MEMPOOL") is True
def test_legacy_pending_migrates_to_mempool():
# Backward-compatibility (A2, "Modo B"): a will saved by an older plugin
# version stores the flag under the legacy "PENDING" key. Loading it must
# carry that flag over to the new "MEMPOOL" status, so nothing is lost.
item = WillItem({"tx": _VALID_TX_HEX, "heirs": {"a": ["addr", 100, "30d"]},
"willexecutor": None, "status": "", "description": "",
"time": 0, "change": "", "baltx_fees": 100,
"PENDING": True})
assert item.get_status("MEMPOOL") is True
def test_new_mempool_wins_over_legacy_pending():
# If both the new "MEMPOOL" key and the legacy "PENDING" key are present,
# the new key wins: an explicit MEMPOOL=False is NOT overridden by a stale
# legacy PENDING=True.
item = WillItem({"tx": _VALID_TX_HEX, "heirs": {"a": ["addr", 100, "30d"]},
"willexecutor": None, "status": "", "description": "",
"time": 0, "change": "", "baltx_fees": 100,
"MEMPOOL": False, "PENDING": True})
assert item.get_status("MEMPOOL") is False
def test_updated_status_keeps_valid():
# A2 rule: setting UPDATED must NOT clear the VALID flag (the tx is replaced
# by a new one that keeps the same locktime and same heirs).
item = WillItem({"tx": _VALID_TX_HEX, "heirs": {"a": ["addr", 100, "30d"]},
"willexecutor": None, "status": "", "description": "",
"time": 0, "change": "", "baltx_fees": 100,
"VALID": True})
item.set_status("UPDATED", True)
assert item.get_status("UPDATED") is True
assert item.get_status("VALID") is True
def test_anticipated_status_keeps_valid():
# A2 rule: setting ANTICIPATED must NOT clear the VALID flag (anticipating
# only moves the locktime 1 day earlier; the tx stays valid).
item = WillItem({"tx": _VALID_TX_HEX, "heirs": {"a": ["addr", 100, "30d"]},
"willexecutor": None, "status": "", "description": "",
"time": 0, "change": "", "baltx_fees": 100,
"VALID": True})
item.set_status("ANTICIPATED", True)
assert item.get_status("ANTICIPATED") is True
assert item.get_status("VALID") is True
def test_mempool_status_clears_valid():
# A2 rule (unchanged from old PENDING behaviour): setting MEMPOOL clears the
# VALID flag.
item = WillItem({"tx": _VALID_TX_HEX, "heirs": {"a": ["addr", 100, "30d"]},
"willexecutor": None, "status": "", "description": "",
"time": 0, "change": "", "baltx_fees": 100,
"VALID": True})
item.set_status("MEMPOOL", True)
assert item.get_status("MEMPOOL") is True
assert item.get_status("VALID") is False
def test_check_invalidated_invalidated():
@@ -129,9 +189,11 @@ def test_check_will():
"willexecutor": None, "status": "", "description": "",
"time": 0, "change": "", "baltx_fees": 100})
will = {"wid": item}
Will.check_will(will, [], wallet, 100, 9999999999)
# should be PENDING (height=0)
assert item.get_status("PENDING") is True
# check_will signature is now (will, all_utxos, wallet, timestamp_to_check):
# block_to_check was removed in A1 (locktimes are always timestamps).
Will.check_will(will, [], wallet, 9999999999)
# should be MEMPOOL (height=0); PENDING was renamed to MEMPOOL in A2.
assert item.get_status("MEMPOOL") is True
# ------------------------------------------------------------------ #