`bump_fee` only required `change > fee delta`. A change at the 294 sat minimum (a full-balance
withdrawal) shrank to ~153 sat after the very first minimum bump, relay policy refuses a
replacement with a sub-dust output, and the bumper tried again every 30 seconds for ever, with
nothing but a log line to show for it.
- When what would be left of the reducible output (the user's change, a payout's bump
reserve) is under DUST_LIMIT_SATS the output is dropped and its whole value goes to the fee:
that replacement is valid and the last one possible. If the output does not exist, or even
its whole value is below BIP125's minimum increase (vsize x 1 sat/vB), RbfError. The
recorded fee rate uses the replacement's own, smaller, size.
- RbfError now carries a `reason` (`change_too_small`, `max_fee_rate`, `replacement_rejected`);
RbfBumper._record_failure writes one `rbf_bump_failed` row {pending_transaction_id, kind,
txid, reason, message[:200]} with the row's user_id/round_id, in a transaction of its own,
once per (current txid, reason) - the audit log is the dedupe clock (AUD-09) - and the pending
row is untouched. A new txid or a new reason writes a new row.
- bump_fee's docstring no longer cites the "bet without change" case that B-62 removed.
No existing test changed (all bumps they make leave a change well above dust). New
tests/unit/test_rbf_dust.py: the 294 sat case end to end (recipient untouched, whole change to
the fee, last bump impossible), the exact boundary (leaves 294 kept / leaves 293 dropped), a
change under the minimum increase, a payout's reserve dropped with the winner and fee outputs
byte-identical, and the audit rows for each reason, once per pair, new row on a new txid or
reason, round/user attribution. Mutation-checked: the dust test of the output and the
once-per-pair check each fail tests.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Documentazione di PLM Lottery
Questa cartella è la fonte di verità del progetto: si lavora docs-first (prima si scrive o si modifica la documentazione, poi il codice) e ogni informazione ha un solo proprietario (SSOT). Questo file è l'indice: da qui si raggiunge tutto il resto.
I tre principi
- Docs-first. Nessuna modifica di comportamento parte dal codice. Si modifica il requisito (o si scrive l'ADR, se è una scelta nuova), poi si implementa, poi si testa. Spec, codice e test entrano nello stesso commit.
- SSOT — un solo proprietario per ogni informazione. Il perché di una
scelta sta in un ADR; il cosa verificabile in un requisito
(
PREFISSO-NN) del documento di dominio; il come nel codice; la cronologia dei difetti instorico-bug.md. Gli altri documenti rimandano all'ID, non ripetono il testo. Se due documenti dicono cose diverse, vince la specifica e si corregge l'altro. - Un ADR per ogni funzionalità. Ogni funzionalità nuova inizia con un ADR in adr/ (modello: adr/TEMPLATE.md) che registra contesto, decisione, alternative scartate e conseguenze, e ne elenca i requisiti.
Dove si trova cosa
| Domanda | Dove |
|---|---|
| Perché è fatto così? Quali alternative sono state scartate? | adr/ — indice per area e tabella funzionalità → ADR |
| Cosa deve fare esattamente il software? | I documenti di dominio qui sotto (requisiti con ID stabile) |
| Quali limiti abbiamo accettato? | limiti-noti.md (LIM-nn) |
| Che bug sono stati trovati/corretti? Quali restano aperti? | storico-bug.md; i soli aperti in ../BUGS.md |
| In che ordine si implementano le correzioni aperte? | piano-correzioni.md |
| Come si modifica la documentazione/il codice? | processo-di-modifica.md |
| Come si installa, si avvia, si usa? | Guide operative qui sotto |
Specifica (documenti di dominio)
Punto d'ingresso narrativo: come-funziona.md.
| Documento | Prefisso | Contenuto |
|---|---|---|
| registrazione-e-depositi.md | REG, DEP |
Account, indirizzi, depositi, saldo |
| scommesse-e-prelievi.md | BET, WDR |
Scommesse e prelievi |
| ciclo-di-vita-del-round.md | RND |
Apertura, chiusura, estrazione, pagamento |
| transazioni-e-riconciliazione.md | TX |
Ciclo di vita delle transazioni, RBF, riconciliazione |
| connessione-electrum.md | ELC |
Accesso alla rete PLM e difese |
| architettura.md | ARC |
Struttura del codice, processi, frontend, test |
| modello-dati.md | DAT |
Tabelle, campi, stati, vincoli |
| api.md | API |
Endpoint, risposte, codici di errore |
| sicurezza.md | SEC |
Fiducia, chiavi, autenticazione, limiti sui tentativi |
| audit-log.md | AUD |
Catalogo degli eventi di audit |
| operativita.md | OPS |
Backup, riavvii, incidenti |
Decisioni, limiti, storia
| Documento | Prefisso | Contenuto |
|---|---|---|
| adr/ | ADR |
Una decisione di progetto per file (53 al momento) |
| limiti-noti.md | LIM |
Limiti accettati consapevolmente |
| storico-bug.md | B-nn |
Tutti i bug trovati e corretti |
| piano-correzioni.md | — | Ordine di implementazione delle correzioni aperte |
Guide operative (senza requisiti)
setup.md · running-the-server.md · guida-utente.md · guida-admin.md. Si aggiornano quando la specifica cambia qualcosa di visibile.
Lingua
La documentazione di docs/ è in italiano, per scelta esplicita; tutto il
resto del repository (codice, commenti, commit, CLAUDE.md, BUGS.md) è in
inglese.