Skip to content

fix(#109): Sync daemon_state.inserted_cents when plugin deducts/refunds#145

Merged
kmatzen merged 2 commits intomainfrom
fix/issue-109-inserted-cents-sync
Feb 24, 2026
Merged

fix(#109): Sync daemon_state.inserted_cents when plugin deducts/refunds#145
kmatzen merged 2 commits intomainfrom
fix/issue-109-inserted-cents-sync

Conversation

@kmatzen
Copy link
Copy Markdown
Owner

@kmatzen kmatzen commented Feb 24, 2026

Fixes #109

Problem: daemon_state->inserted_cents and classic_phone_data.inserted_cents could desync when the plugin deducted for paid calls (only plugin updated) or refunded on call failure (only plugin updated).

Fix:

  • Add plugins_adjust_inserted_cents(int delta) so plugins can sync daemon_state when they deduct or refund coins
  • classic_phone calls it when deducting for paid call and when refunding on call-failed-during-dial (Outgoing call fails: stuck on Dialing, coins lost until hang up #91 path)
  • daemon implements with mutex; simulator and unit_tests have stubs

Result: API, persistence, and display all agree on coin balance.

Made with Cursor

kmatzen and others added 2 commits February 23, 2026 21:59
- Add plugins_adjust_inserted_cents(delta) for plugins to sync coin state
- classic_phone: call it when deducting for paid call and when refunding on call failure
- daemon: implement with mutex; prevents API/persistence showing wrong balance
- Simulator and unit_tests: add stub implementations

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@kmatzen kmatzen merged commit e16f401 into main Feb 24, 2026
1 check passed
@kmatzen kmatzen deleted the fix/issue-109-inserted-cents-sync branch February 24, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

daemon_state.inserted_cents vs plugin inserted_cents sync

1 participant