A3: simulated ledger with idempotency (WEB-22, WEB-23, ADR-59, ARC-75..77, DAT-80)
One Ledger interface (deposit, bet, confirm, reject, exclude, payout) with a simulated implementation chosen by LEDGER_BACKEND, refused on mainnet. Every operation is a single write-locked transaction with its audit row; the same request key is the same operation, a key reused for something else is an error. The server validates round, deadline, the round's own quota, limits and funds. The balance is derived from the ledger. Tests include six processes racing on one SQLite file; the idempotency tests were checked to fail when the replay is removed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0eba7bcfe6
commit
eded058dbb
12 files changed
+924
-4
No files matched your search
@@ -80,8 +80,14 @@ backend FastAPI (vedi [architettura.md](architettura.md)).
|
||||
- **[WEB-22]** Prima di inviare una puntata si mostrano round e importo; il
|
||||
server valida disponibilità, quota, limiti e stato del round. Dopo l'invio
|
||||
si mostra lo stato effettivo (attesa, conferma, rifiuto o esclusione).
|
||||
*Stato:* validazione e stati implementati nel ledger (A3: round, scadenza, quota del round, limiti, fondi,
|
||||
`round_closing`, `already_betting`, `round_full`, `bets_suspended`, `balance_pending_confirmation`, rifiuto ed esclusione);
|
||||
la schermata con l'A7 ·
|
||||
*Codice:* `apps/lottery/ledger.py:SimulatedLedger.place_bet` · *Test:* `tests/django/test_ledger.py`
|
||||
- **[WEB-23]** Un doppio invio della stessa richiesta produce una sola
|
||||
operazione logica (chiave di idempotenza associata alla richiesta).
|
||||
*Stato:* implementato nel ledger (A3, [ARC-76]); il modulo di invio con l'A7 ·
|
||||
*Test:* `tests/django/test_ledger.py::test_the_same_bet_request_is_one_bet`
|
||||
- **[WEB-24]** Il prelievo mostra, prima della conferma, indirizzo, importo
|
||||
richiesto, commissione e importo netto previsto. Lo storico distingue lo stato
|
||||
dell'operazione dal TXID corrente e lo collega all'explorer quando disponibile.
|
||||
|
||||
Reference in new issue
Block a user