diff options
| author | Your Name <you@example.com> | 2026-05-18 14:50:41 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-18 14:50:41 +0530 |
| commit | 2a86bec93273e2f4ceeab60683058c65dbb1da3d (patch) | |
| tree | 56e66acc4eaa0b5a947bb78d28e494a0adc857e2 /main/tollgate_main.c | |
| parent | 0c3f08ac7cf8e970369ec137153107ca8edc3326 (diff) | |
feat: multi-mint health tracker, discovery, portal, multi-wallet (Phase 3-8)
- mint_health.h/c: FreeRTOS probing task, GET /v1/info every 5min,
recovery threshold 3, immediate failure, mutex-protected state
- cashu.c: health-gated acceptance (config match AND reachable)
- tollgate_api.c: one price_per_step tag per reachable mint in discovery
- captive_portal.c: mint list with green/grey indicators, /mints API,
auto-refresh every 30s via JS
- nucula_wallet.h/cpp: multi-wallet (up to 4), route receive to correct
wallet by mint URL, balance sums across all wallets
- tollgate_main.c: init health tracker + multi-wallet on service start
- CMakeLists.txt: add mint_health.c
Diffstat (limited to 'main/tollgate_main.c')
| -rw-r--r-- | main/tollgate_main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/main/tollgate_main.c b/main/tollgate_main.c index c0ff65f..5f3e0e1 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include "wifistr.h" | 22 | #include "wifistr.h" |
| 23 | #include "tollgate_client.h" | 23 | #include "tollgate_client.h" |
| 24 | #include "lightning_payout.h" | 24 | #include "lightning_payout.h" |
| 25 | #include "mint_health.h" | ||
| 25 | #include "cvm_server.h" | 26 | #include "cvm_server.h" |
| 26 | #include "display.h" | 27 | #include "display.h" |
| 27 | 28 | ||
| @@ -151,7 +152,15 @@ static void start_services(void) | |||
| 151 | session_manager_init(); | 152 | session_manager_init(); |
| 152 | 153 | ||
| 153 | const tollgate_config_t *cfg = tollgate_config_get(); | 154 | const tollgate_config_t *cfg = tollgate_config_get(); |
| 154 | nucula_wallet_init(cfg->mint_url); | 155 | |
| 156 | mint_health_init(cfg->accepted_mints, cfg->accepted_mint_count); | ||
| 157 | mint_health_start(); | ||
| 158 | |||
| 159 | if (cfg->accepted_mint_count > 1) { | ||
| 160 | nucula_wallet_init_multi(cfg->accepted_mints, cfg->accepted_mint_count); | ||
| 161 | } else { | ||
| 162 | nucula_wallet_init(cfg->mint_url); | ||
| 163 | } | ||
| 155 | lightning_payout_init(&cfg->payout); | 164 | lightning_payout_init(&cfg->payout); |
| 156 | 165 | ||
| 157 | dns_server_start(ap_ip_info.ip, upstream_dns); | 166 | dns_server_start(ap_ip_info.ip, upstream_dns); |
| @@ -187,6 +196,7 @@ static void stop_services(void) | |||
| 187 | captive_portal_stop(); | 196 | captive_portal_stop(); |
| 188 | tollgate_api_stop(); | 197 | tollgate_api_stop(); |
| 189 | dns_server_stop(); | 198 | dns_server_stop(); |
| 199 | mint_health_stop(); | ||
| 190 | cvm_server_stop(); | 200 | cvm_server_stop(); |
| 191 | firewall_revoke_all(); | 201 | firewall_revoke_all(); |
| 192 | s_services_running = false; | 202 | s_services_running = false; |