`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>
2.6 KiB
ADR-19 — Ogni transazione utente conserva un'uscita di resto verso l'utente, e un'accelerazione che porterebbe quel resto sotto DUST_LIMIT_SATS (294 sat) lo elimina
- Stato: Accettata
- Area: Economia del gioco
- Fonte di verità per: la scelta di progetto descritta qui sotto; i requisiti (
PREFISSO-NN) che la attuano stanno nei documenti di dominio, indicati nelle Conseguenze.
Decisione
Ogni transazione utente conserva un'uscita di resto verso
l'utente, e un'accelerazione che porterebbe quel resto sotto
DUST_LIMIT_SATS (294 sat) lo elimina. Le regole sono di
BET-14 e
WDR-09 (resto minimo alla costruzione)
e di TX-11
(resto eliminato all'accelerazione, B-87).
- Motivazione: un prelievo totale produceva una transazione a un'uscita che nessun RBF poteva salvare (B-62); aggiungere monete non avrebbe aiutato, perché la transazione le spendeva già tutte. Il resto minimo di 294 sat però non basta a restare accelerabile: il primo aumento minimo (1 sat/vB sull'intera transazione, 141 sat per un ingresso e due uscite) lo porta a 153 sat, sotto la soglia di polvere, e ogni sostituzione successiva viene rifiutata dalle regole di inoltro (B-87). Garantisce l'esistenza dell'uscita, non la capacità di assorbire aumenti.
- Alternative scartate: un resto minimo più grande (sottrae all'utente un importo che deve comunque poter prelevare, e sposta solo la soglia); aggiungere ingressi alla sostituzione (nel caso che conta, il prelievo totale, non ce ne sono altri).
- Conseguenze: quando il resto scende sotto soglia, il suo valore va in commissione e la sostituzione è l'ultima possibile per quella transazione; l'utente perde al più 294 sat. Il pagamento del round non ha un resto utente: la sua uscita riducibile è la riserva di ADR-17.
Codice: app/wallet/psbt_builder.py:build_signed_transaction · app/withdrawals/service.py:request_withdrawal · app/tx/broadcast.py:bump_fee ·
Test: tests/unit/test_rbf_dust.py::test_a_minimum_change_is_dropped_into_the_fee_by_the_first_bump, tests/unit/test_rbf_dust.py::test_the_dust_boundary_of_what_a_bump_leaves, tests/unit/test_psbt_builder.py::test_build_signed_transaction_refuses_an_amount_that_would_leave_no_change, tests/unit/test_withdrawals.py::test_full_balance_withdrawal_keeps_a_bumpable_change_output, tests/unit/test_withdrawals.py::test_a_bet_from_a_balance_equal_to_the_bet_is_refused