The previous fix (3e75769a4) let a due sweep give way once to a consolidation
round that was running or "due within 5 blocks", and then hold every new
consolidation round off until the sweep had run. On a wallet that always has
something to sweep this starved consolidation instead: the 5-block "give way"
itself set the waiting flag, the next consolidation was refused because a sweep
was waiting, the sweep ran, and so on.
Measured on the 2026-11-30 soak of 9c7c5835b (exchange-style wallet, zsweep
every 5 blocks, consolidation at the default 25): in 15.5 h, 2,375 sweep txs and
0 consolidation txs (273 deferrals); the withdraw address piled up to 5,898
unspent notes and RSS reached 4.7 GB.
Now the two ops take strict turns:
- a due sweep that finds a consolidation round running sets fSweepWaiting, and
no new consolidation round starts until the sweep is dispatched;
- a due consolidation round that finds a sweep running sets
fConsolidationWaiting, and no new sweep round starts until it is dispatched;
- the 5-block blackout is gone (with consolidationinterval=5 it was always true);
- whichever op yields clears its own flag, so they can never both be waiting;
- each flag is cleared on dispatch, when its op is off, or when it is skipped for
a locked wallet.
z_consolidationstatus gains waiting_for_sweep, next to z_sweepstatus's
waiting_for_consolidation. doc/zsweep-consolidation.md updated.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>