fix(monitoring): fresh wallet DB per ladder rung

This commit is contained in:
Hernâni Marques 2026-07-16 23:14:25 +02:00
parent f99604261a
commit 4ec9f07276
No known key found for this signature in database

View file

@ -207,13 +207,22 @@ ms_tok=$(elapsed_ms "$t0")
[ -n "$TOK" ] || { err bank "explorer token failed"; exit 1; } [ -n "$TOK" ] || { err bank "explorer token failed"; exit 1; }
ok "explorer token (${ms_tok}ms)" ok "explorer token (${ms_tok}ms)"
# --- wallet exchange + ToS --- # Fresh wallet DB per rung: without run-until-done the same reserve_pub is reused
# → bank 409 "Reserve pub already used" on later force-selects.
wallet_prepare() {
local label="${1:-wallet}"
WDB="$SCRATCH/wallet-${label}.sqlite3"
export WDB
rm -f "$WDB"
wcli exchanges add "$EX" >"$SCRATCH/ex-add-$label.out" 2>&1 || true
wcli exchanges update "$EX" >"$SCRATCH/ex-upd-$label.out" 2>&1 || true
wcli exchanges accept-tos "$EX" >"$SCRATCH/ex-tos-$label.out" 2>&1 || true
}
t0=$(now_ms) t0=$(now_ms)
wcli exchanges add "$EX" >"$SCRATCH/ex-add.out" 2>&1 || true wallet_prepare "bootstrap"
wcli exchanges update "$EX" >"$SCRATCH/ex-upd.out" 2>&1 || true
wcli exchanges accept-tos "$EX" >"$SCRATCH/ex-tos.out" 2>&1 || true
ms_tos=$(elapsed_ms "$t0") ms_tos=$(elapsed_ms "$t0")
ok "wallet exchange + ToS (${ms_tos}ms)" ok "wallet exchange + ToS (${ms_tos}ms) — fresh DB per rung (no run-until-done)"
LADDER_LIST=$(build_ladder) LADDER_LIST=$(build_ladder)
: "${LADDER_MAX_RUNGS:=99}" : "${LADDER_MAX_RUNGS:=99}"
@ -258,6 +267,10 @@ for AMT in "$@"; do
note="" note=""
status="FAIL" status="FAIL"
WID="-" WID="-"
FORCE_SEL_409_LOGGED=0
# New wallet sqlite for this rung → unique reserve_pub (avoids bank 5114)
wallet_prepare "r${rung}"
# mint from explorer pool # mint from explorer pool
t0=$(now_ms) t0=$(now_ms)