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

@@ -13,6 +13,8 @@ import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir))
import pytest
from bal.core.util import Util, LOCKTIME_THRESHOLD
@@ -32,10 +34,14 @@ def test_locktime_to_str():
def test_str_to_locktime():
# relative suffixes pass through
# relative suffixes pass through (only days "d" and years "y" are supported)
assert Util.str_to_locktime("30d") == "30d"
assert Util.str_to_locktime("1y") == "1y"
assert Util.str_to_locktime("144b") == "144b"
# the block-height suffix "b" was removed (A1): "144b" is no longer a valid
# relative locktime, so it is NOT passed through unchanged.
with pytest.raises(Exception):
Util.str_to_locktime("144b")
# integer string -> int
assert isinstance(Util.str_to_locktime("500000"), int)
@@ -69,12 +75,12 @@ def test_parse_locktime_string():
def test_int_locktime():
# int_locktime no longer accepts a "blocks" argument (A1): locktimes are
# always expressed in seconds (timestamps), never in block counts.
assert Util.int_locktime(seconds=1) == 1
assert Util.int_locktime(minutes=1) == 60
assert Util.int_locktime(hours=1) == 3600
assert Util.int_locktime(days=1) == 86400
assert Util.int_locktime(blocks=1) == 600
assert Util.int_locktime(days=1, blocks=1) == 86400 + 600
assert Util.int_locktime() == 0
@@ -223,40 +229,35 @@ def test_get_value_amount():
def test_chk_locktime():
# chk_locktime signature is now (timestamp_to_check, locktime) (A1):
# block-height handling was removed, locktimes are always timestamps.
now_ts = 1700000000
now_block = 800000
# timestamp locktime still in future
assert Util.chk_locktime(now_ts, now_block, 1800000000) is True
assert Util.chk_locktime(now_ts, 1800000000) is True
# timestamp locktime in past
assert Util.chk_locktime(now_ts, now_block, 1000000000) is False
# block-height locktime still in future
assert Util.chk_locktime(now_ts, now_block, 900000) is True
# block-height locktime in past
assert Util.chk_locktime(now_ts, now_block, 100000) is False
assert Util.chk_locktime(now_ts, 1000000000) is False
def test_anticipate_locktime():
# block-height style (note: "anticipate" actually adds for block locktimes)
result = Util.anticipate_locktime(800000, blocks=100)
assert result == 800000 + 100
# anticipate_locktime no longer accepts a "blocks" argument (A1):
# it only moves a timestamp earlier (by hours/days).
# timestamp style
# timestamp style: anticipating by 1 day moves the locktime earlier
ts = 1700000000
result = Util.anticipate_locktime(ts, days=1)
assert result < ts
assert result > 0
assert result == ts - 86400
# overflow handling (Windows-safe)
huge = 2**32 - 1 # NLOCKTIME_MAX
result = Util.anticipate_locktime(huge, days=1)
assert result > 0
# clamp to minimum 1
low = Util.anticipate_locktime(10, blocks=100)
# clamp to minimum 1 (anticipating a tiny value never goes below 1)
low = Util.anticipate_locktime(10, days=1)
assert low >= 1