diff options
| author | Your Name <you@example.com> | 2026-05-16 15:32:55 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-16 15:32:55 +0530 |
| commit | 133e40c82afb4d7659758b1fa57925ac57af4621 (patch) | |
| tree | 130f43e668f42f8fcc8ef55808ba89b6db40f615 /main/config.c | |
| parent | 8f0aeb7d7b8216f1fc906cf855e5be9e90ecc0a8 (diff) | |
Phase 3: on-device Cashu wallet with mbedTLS secp256k1 + SPIFFS persistence + PSRAM
- wallet.c/h: secp256k1 ECP primitives (hash_to_curve, scalar_mul, point_add)
- wallet_persist.c/h: SPIFFS persistence with threshold-based write protection
- Fee accounting for swap (input_fee_ppk from /v1/keysets)
- Keyset fetch via /v1/keysets (586 bytes vs 21KB for /v1/keys)
- Wallet API: GET /wallet, POST /wallet/swap, POST /wallet/send
- Payment proofs auto-stored to wallet + persisted on SPIFFS
- PSRAM enabled for large allocations (ESP32-S3 has 8MB)
- Wallet init deferred to dedicated task (avoids sys_evt stack overflow)
- Cashu proof ID buffer size fixed (66 hex chars, not 16)
- HTTP client: added fetch_headers() call for proper response handling
- persist_threshold_sats config parameter (default: 1 sat)
Diffstat (limited to 'main/config.c')
| -rw-r--r-- | main/config.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/main/config.c b/main/config.c index d7837bc..7e8a14c 100644 --- a/main/config.c +++ b/main/config.c | |||
| @@ -19,6 +19,7 @@ esp_err_t tollgate_config_init(void) | |||
| 19 | g_config.ap_max_conn = 4; | 19 | g_config.ap_max_conn = 4; |
| 20 | g_config.price_per_step = 21; | 20 | g_config.price_per_step = 21; |
| 21 | g_config.step_size_ms = 60000; | 21 | g_config.step_size_ms = 60000; |
| 22 | g_config.persist_threshold_sats = 1; | ||
| 22 | 23 | ||
| 23 | esp_vfs_spiffs_conf_t conf = { | 24 | esp_vfs_spiffs_conf_t conf = { |
| 24 | .base_path = "/spiffs", | 25 | .base_path = "/spiffs", |
| @@ -117,6 +118,9 @@ esp_err_t tollgate_config_init(void) | |||
| 117 | cJSON *step = cJSON_GetObjectItem(root, "step_size_ms"); | 118 | cJSON *step = cJSON_GetObjectItem(root, "step_size_ms"); |
| 118 | if (step) g_config.step_size_ms = step->valueint; | 119 | if (step) g_config.step_size_ms = step->valueint; |
| 119 | 120 | ||
| 121 | cJSON *persist = cJSON_GetObjectItem(root, "persist_threshold_sats"); | ||
| 122 | if (persist) g_config.persist_threshold_sats = (uint64_t)persist->valuedouble; | ||
| 123 | |||
| 120 | cJSON_Delete(root); | 124 | cJSON_Delete(root); |
| 121 | ESP_LOGI(TAG, "Config loaded: AP='%s', %d WiFi networks, price=%d sats/%dms", | 125 | ESP_LOGI(TAG, "Config loaded: AP='%s', %d WiFi networks, price=%d sats/%dms", |
| 122 | g_config.ap_ssid, g_config.network_count, g_config.price_per_step, g_config.step_size_ms); | 126 | g_config.ap_ssid, g_config.network_count, g_config.price_per_step, g_config.step_size_ms); |