fix: cap DCA allocations when ATM cash exceeds tracked balances #2

Closed
padreug wants to merge 1 commit from fix/cap-dca-allocations-sync-mismatch into main

1 commit

Author SHA1 Message Date
Patrick Mulligan
5e8110f322 fix: cap DCA allocations when ATM cash exceeds tracked balances
Some checks failed
CI / lint (pull_request) Has been cancelled
CI / tests (3.10) (pull_request) Has been cancelled
CI / tests (3.9) (pull_request) Has been cancelled
When total tracked client balances < transaction fiat amount (sync
mismatch), the proportional allocation formula was giving each client
more GTQ-equivalent sats than their actual remaining balance, causing
all payments to be refused.

Changes:
- Add sync mismatch detection in calculate_distribution_amounts()
- Cap allocations to remaining balance when sync mismatch detected
- Track orphan sats (unallocated due to sync mismatch)
- Update return type to tuple (distributions, orphan_sats)
- Log orphan amounts for reconciliation tracking

Fixes #1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 23:41:16 +01:00