Wallets

Wallets
Source snapshot: 9b4f8a3 (2026-09-23); retained QMail clone, including M7.
Working = implemented in this snapshot, not a new runtime/test certification.
Partial = an identified implementation/exposure gap; obsolete = retained compatibility only.
Entry points and static functions are selected navigation anchors; full lexical index: function-index.txt.
Used by / Tests list selected source references (including callback registration), not a proven dynamic call graph.
Tests were inspected, not executed; use tools/test.ps1 with isolated scratch data.
Old paths come from docs/path-map.txt; absent mappings denote additions after the move.

Wallet store and locks

Purpose
Manage wallet directories, wallet activity, Client_Data instance ownership and durable task files.
Files
src/coin/wallet.c src/coin/wallet_lock.c src/coin/instance_lock.c src/coin/filesystem.c src/coin/filesystem_directories.inc src/coin/commands/cmd_wallet.c src/coin/commands/cmd_wallet_wrappers.c src/coin/task_manager.c
Old paths
vendor/core/src/wallet.c -> src/coin/wallet.c vendor/core/src/wallet_lock.c -> src/coin/wallet_lock.c vendor/core/src/instance_lock.c -> src/coin/instance_lock.c vendor/core/src/filesystem.c -> src/coin/filesystem.c vendor/core/src/filesystem_directories.inc -> src/coin/filesystem_directories.inc vendor/core/src/commands/cmd_wallet.c -> src/coin/commands/cmd_wallet.c vendor/core/src/commands/cmd_wallet_wrappers.c -> src/coin/commands/cmd_wallet_wrappers.c vendor/core/src/task_manager.c -> src/coin/task_manager.c
Public header
include/core/cmd_wallet.h include/core/cmd_wallet_wrappers.h include/core/filesystem.h include/core/instance_lock.h include/core/task_manager.h include/core/wallet.h include/core/wallet_lock.h
Entry points
src/coin/wallet.c:152 :: wallet_create() src/coin/wallet_lock.c:14 :: wallet_lock_acquire() src/coin/instance_lock.c:25 :: instance_lock_init() src/coin/filesystem.c:59 :: fs_flush_file_sync() src/coin/filesystem_directories.inc:32 :: fs_create_directories() src/coin/commands/cmd_wallet.c:437 :: cmd_wallet_create() src/coin/commands/cmd_wallet_wrappers.c:20 :: cmd_wallet_withdraw_with_logging() src/coin/task_manager.c:257 :: rest_task_generate_id()
Important static functions
src/coin/instance_lock.c:35 :: write_owner_stamp() src/coin/commands/cmd_wallet.c:98 :: read_active_template() src/coin/commands/cmd_wallet.c:123 :: write_active_template() src/coin/task_manager.c:52 :: task_write_lock() src/coin/task_manager.c:53 :: task_write_unlock() src/coin/wallet.c:43 :: normalize_registry_path_copy() src/coin/wallet.c:77 :: wallet_registry_paths_equal() src/coin/filesystem.c:42 :: fs_move_replace()
Owns
Wallet folder registry, activity locks and instance lock.
Used by
src/app/desktop_api.c src/app/desktop_api_more.c src/coin/boot_encryption_check.c src/coin/coin_file.c src/coin/core_bootstrap.c src/coin/drd_sync.c src/coin/encryption_key.c src/coin/health_manager.c
Side effects
Creates or reads wallet folders, acquires locks and persists task/transaction data; Amount arithmetic is pure.
Tests
tests/integ/hosting_adapter_test.c tests/integ/session_coordinator_test.c tests/unit/desktop_api_test.c tests/unit/long_path_test.c tests/unit/long_path_transfer_test.c tests/unit/telemetry_rotation_test.c tests/unit/coin/encryption_keys_wallet_test.c tests/unit/coin/fs_quarantine_move_test.c
Platforms
Windows; POSIX branches/dependencies where present. Linux/macOS runtime unverified in M13.
Status
working

Desktop wallet operations

Purpose
Expose deposit, export, balance, healing, backup and wallet listings to the in-process GUI.
Files
src/app/desktop_api.c src/app/desktop_api_more.c
Old paths
src/desktop_api/desktop_api.c -> src/app/desktop_api.c src/desktop_api/desktop_api_more.c -> src/app/desktop_api_more.c
Public header
include/qmail/desktop_api.h
Entry points
src/app/desktop_api.c:3323 :: qmail_desktop_api_wallet_deposit() src/app/desktop_api.c:3212 :: qmail_desktop_api_wallet_export() src/app/desktop_api.c:1711 :: qmail_desktop_api_wallet_balance() src/app/desktop_api.c:3242 :: qmail_desktop_api_wallet_heal() src/app/desktop_api.c:282 :: qmail_desktop_api_identity_lock() src/app/desktop_api_more.c:104 :: qmail_desktop_api_search_messages()
Important static functions
src/app/desktop_api.c:335 :: change_pw_file_read() src/app/desktop_api.c:358 :: change_pw_file_write() src/app/desktop_api_more.c:37 :: clear_error() src/app/desktop_api_more.c:45 :: fail()
Owns
Desktop wallet operation surface; delegates coin rules to the Coins group.
Used by
src/app/client.c src/app/client_inproc.c src/app/main.c
Side effects
Creates or reads wallet folders, acquires locks and persists task/transaction data; Amount arithmetic is pure.
Tests
tests/live/attachment_download_probe.c tests/live/contacts_probe.c tests/live/draft_probe.c tests/live/drd_profile_probe.c tests/live/get_message_probe.c tests/live/large_send_live_probe.c tests/live/mail_action_probe.c tests/live/object_transfer_probe.c
Platforms
Windows; POSIX branches/dependencies where present. Linux/macOS runtime unverified in M13.
Status
working; Files are shared with other desktop operations; multi-wallet UI readiness is separately reported by feature_catalog.c.

Amount arithmetic

Purpose
Parse and format exact monetary values using 1 CC = 100,000,000 units.
Files
src/mail/qmail_amount.c
Old paths
vendor/core/src/qmail/qmail_amount.c -> src/mail/qmail_amount.c
Public header
include/qmail/qmail_amount.h
Entry points
src/mail/qmail_amount.c:15 :: qmail_fee_parse()
Important static functions
src/mail/qmail_amount.c:58 :: ceil_rem_times_rate_over_mib()
Owns
Integer microunit arithmetic and amount validation.
Used by
src/coin/core_bootstrap.c src/coin/qmail_locker_pool.c src/coin/qmail_parent_funding.inc src/mail/qmail_coin_select.c src/mail/qmail_db.c src/mail/qmail_funding_journal.inc src/mail/qmail_receipt.c src/mail/qmail_tell_retry.c
Side effects
Pure parsing/formatting and caller-buffer writes; no network or wallet mutation.
Tests
tests/unit/coin/qmail_amount_test.c
Platforms
Windows; POSIX branches/dependencies where present. Linux/macOS runtime unverified in M13.
Status
working