fix 1.22.1: pay-wait withdraw board (start order + pendingIncoming)

UX fix: after bank OK_BANK, available is often still 0 while pendingIncoming
ticks up. The silent wait looked hung. Show OK/OK_BANK withdraws in the order
they started, match wallet txs, and update pendingIncoming→done with a timer
on the same wallet DB. Short run-pending only; default wait 90s.
This commit is contained in:
Hernâni Marques 2026-07-19 14:34:47 +02:00
parent 35cd86bd43
commit fd5ac80566
No known key found for this signature in database
6 changed files with 232 additions and 6 deletions

View file

@ -87,8 +87,8 @@ elapsed_ms() {
: "${LADDER_HIGH_RUNGS:=6}"
# optional seed for reproducible max-search (empty = time-based)
: "${LADDER_MAX_SEED:=}"
# After withdraw, wait for spendable available>0 before pay (secs total)
: "${LADDER_PAY_WAIT_AVAILABLE_S:=60}"
# After withdraw, wait for spendable available>0 before pay (secs total; shows countdown)
: "${LADDER_PAY_WAIT_AVAILABLE_S:=90}"
# Historic libeufin-ish absolute ceiling used as default LADDER_MAX_AMOUNT on GOA
LADDER_ABS_CEILING="4503599627370496"
@ -308,6 +308,31 @@ print("0")
' "$CUR" 2>/dev/null || echo "0"
}
# pendingIncoming for same currency (same wallet DB as withdraw) — "0" if missing
wallet_pending_in() {
wcli balance 2>/dev/null | python3 -c '
import json,sys
t=sys.stdin.read()
dec=json.JSONDecoder()
i=t.find("{")
if i<0:
print("0"); raise SystemExit
try:
d,_=dec.raw_decode(t,i)
except Exception:
try:
d=json.loads(t[i:t.rfind("}")+1])
except Exception:
print("0"); raise SystemExit
cur=sys.argv[1]
for b in d.get("balances") or []:
a=b.get("pendingIncoming") or b.get("pending_incoming") or ""
if a.startswith(cur+":"):
print(a.split(":",1)[1]); raise SystemExit
print("0")
' "$CUR" 2>/dev/null || echo "0"
}
# Build paired pay + withdraw ladders (same step count, shared random shape).
# Pay: [0] + log-uniform mids + [max-1] + [max]
# Wd: [0] + max(mid, mid×scale) mids + [max-1] + [max] (mids higher → enough to spend)