Abandon a transaction only on proof, and keep watching failed rows (B-78, TX-15, TX-17, TX-23, TX-26, ELC-28, DAT-33, DAT-36, DAT-69, DAT-72, AUD-11, AUD-12, AUD-31, AUD-39, API-32)
reconcile_once abandoned a row when the *active* server's history lacked its txid:
after 120s for `building` (which a restart onto a different server makes likely),
after 6h for `pending`, and all at once after a forward clock jump. It re-checked the
status but not the txid, so it raced the bumper, and a `failed` row was never looked at
again.
- The reconciler asks every server (ElectrumListener.get_histories, active + others) for
the history of the row's address and looks for every txid of the row. Present on any
server -> promoted (adopting the version found). Absent is only "no server of the
quorum knows it" and needs the active server plus the quorum minimum of the others to
have answered; even then nothing is released without proof:
(a) an input spent in a block by a transaction that is none of the row's versions,
agreed by a strict majority of a quorum of the other servers (confirmed_spender), or
(b) a rebroadcast of the latest raw tx to every server (rebroadcast_everywhere)
refused by all of them, explicitly, for missing/spent inputs.
Accepted or "already known" by any server means alive; a fee refusal is not proof
(`building` -> `pending` for the bumper, `pending` untouched); too few answers or
anything else leaves the row alone. failure_reason names the proof.
- The write re-reads status *and* current_txid under begin_immediate (TX-26).
- pending_transactions.failed_at (set by _abandon and _release_failed_withdrawal) starts
a 14-day watch: a failed row that a majority of the other servers (at least the quorum
minimum) list in a block becomes `confirmed`, writes pending_tx_resurrected once and
pauses the lottery with paused_reason `resurrected_tx`; linked rows are not corrected.
The confirmation is by quorum of histories for now; merkle proofs come with B-83.
- round_config.paused_reason (migration b7d2e41c9a05, with the failed_at one): `operator`
from POST /admin/pause (which accepts an optional `note` and never overwrites an
automatic reason), cleared by resume, which logs the reason it lifted; exposed on
/admin/config and GET /rounds/current. rounds/pause.py:pause_automatically is the
system's way in.
- PendingTransactionReconciler takes the listener as `network`; with none it can promote
but never abandon.
Tests changed because the spec changed: the three reconciler tests that expect an
abandonment (and the one in test_tx_versions) now supply a network that proves the
transaction is gone.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f936d6660c
commit
a4b160e240
29 files changed
+1280
-201
No files matched your search
+15
-17
@@ -108,16 +108,16 @@ implementato il [piano delle correzioni](piano-correzioni.md).
|
||||
*Codice:* `app/tx/broadcast.py:bump_fee` · `app/wallet/psbt_builder.py:build_payout_transaction` · `app/tx/reconcile.py:reconcile_once`
|
||||
|
||||
- **[LIM-03]** **L'attesa in `closing` non ha un limite proprio.** Il round
|
||||
aspetta ogni scommessa `building`/`broadcast`. Oggi a porre fine all'attesa
|
||||
di una scommessa che non conferma è solo il riconciliatore, dopo 6 ore dal
|
||||
primo invio se la transazione è sparita dalla rete del server attivo; una
|
||||
scommessa ferma ma presente in mempool trattiene il round senza limite
|
||||
([LIM-02]).
|
||||
aspetta ogni scommessa `building`/`broadcast`. A porre fine all'attesa di
|
||||
una scommessa che non conferma è la sua conferma (una qualsiasi delle sue
|
||||
versioni) oppure il riconciliatore, ma solo con la prova che non è partita
|
||||
([ADR-51](adr/ADR-51-dubbio-liberano-mai-fondi.md)); una scommessa ferma ma presente in mempool trattiene il round senza
|
||||
limite ([LIM-02]).
|
||||
- *Impatto:* un round può restare chiuso ma non estratto per ore; nessun
|
||||
nuovo round si apre nel frattempo.
|
||||
- *Mitigazione attuale:* lo stato è visibile (`closing`) e il pannello
|
||||
«Transazioni pendenti» mostra la scommessa che trattiene il round.
|
||||
- *Stato:* da chiudere con B-78 (in parte, per scelta).
|
||||
- *Stato:* B-78 e B-77 chiusi; resta da chiudere B-87 (resto minimo), e per scelta l'assenza di un limite di tempo.
|
||||
- *Per chiuderlo:* con B-78 l'attesa finisce quando la scommessa conferma
|
||||
(una qualsiasi delle sue versioni, B-77) o quando c'è la prova che non
|
||||
confermerà mai ([ADR-51](adr/ADR-51-dubbio-liberano-mai-fondi.md)), non dopo un tempo fisso; con B-87 la scommessa
|
||||
@@ -277,19 +277,17 @@ implementato il [piano delle correzioni](piano-correzioni.md).
|
||||
|
||||
- **[LIM-12]** **Non tutte le letture di rete sono corroborate.** Passano dal
|
||||
solo server attivo: la conferma di scommesse, pagamenti e prelievi
|
||||
(`poll_once`), la decisione del riconciliatore che una transazione «non
|
||||
esiste più», l'elenco delle monete del montepremi usato per il pagamento, e il
|
||||
(`poll_once`), l'elenco delle monete del montepremi usato per il pagamento, e il
|
||||
ripristino di una moneta prima segnata come spesa all'esterno.
|
||||
- *Impatto:* un server ostile potrebbe far considerare confermata una
|
||||
scommessa che non lo è, o far abbandonare a torto una transazione viva
|
||||
(liberandone le monete e, per un pagamento, azzerando `payout_txid`),
|
||||
lasciando il database in disaccordo con la catena; il ripristino non
|
||||
corroborato può reintegrare nel saldo una moneta davvero spesa.
|
||||
- *Mitigazione attuale:* l'abbandono avviene solo dopo 6 ore per `pending`; un
|
||||
invio basato su monete inesistenti è rifiutato dalla rete.
|
||||
- *Stato:* da chiudere con B-83 (conferme e ripristini), B-78 (abbandono),
|
||||
B-82 (monete del round prima del pagamento) e B-76 (invio a tutti i
|
||||
server).
|
||||
scommessa che non lo è, lasciando il database in disaccordo con la
|
||||
catena; il ripristino non corroborato può reintegrare nel saldo una
|
||||
moneta davvero spesa.
|
||||
- *Mitigazione attuale:* l'abbandono richiede una prova ([ADR-51](adr/ADR-51-dubbio-liberano-mai-fondi.md)) e l'invio
|
||||
arriva a tutti i server; un invio basato su monete inesistenti è rifiutato
|
||||
dalla rete.
|
||||
- *Stato:* da chiudere con B-83 (conferme e ripristini) e B-82 (monete del
|
||||
round prima del pagamento).
|
||||
- *Per chiuderlo:* una conferma vale quando il quorum restituisce una prova
|
||||
merkle valida (`blockchain.transaction.get_merkle`) contro un header che
|
||||
possediamo; il ripristino richiede lo stesso quorum di un accredito;
|
||||
|
||||
Reference in new issue
Block a user