From ed06f7eeab28c1fa6242c4ea6c3b9c933661fc06 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 22 May 2026 03:48:46 +0530 Subject: feat(cvm): fix CVM MCP roundtrip - task creation, subscription, relay selection - Move CVM server start before mint_health_start (avoids RAM fragmentation) - Fix NIP-01 subscription: #p tag must be array not string - Fix read loop: tolerate TLS timeouts, don't disconnect - Reduce TLS timeout from 15s to 5s for faster event delivery - Add WS frame logging for debugging - Sign test events with board's nsec (--sec flag) for owner auth - Change default CVM relay to nos.lol (forwards ephemeral kind 25910) - MCP get_config and get_balance roundtrips confirmed working - Unit tests pass (16/16) --- main/tollgate_main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'main/tollgate_main.c') diff --git a/main/tollgate_main.c b/main/tollgate_main.c index 60503eb..2d4fa22 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c @@ -237,6 +237,12 @@ static void start_services(void) session_manager_init(); const tollgate_config_t *cfg = tollgate_config_get(); + + if (cfg->cvm_enabled) { + cvm_server_init(); + cvm_server_start(); + } + mint_health_init(cfg->accepted_mints, cfg->accepted_mint_count); mint_health_start(); @@ -268,19 +274,13 @@ static void start_services(void) xTaskCreate(publish_wifistr_task, "wifistr_init", 16384, NULL, 3, NULL); - const tollgate_config_t *cfg2 = tollgate_config_get(); - if (cfg2->cvm_enabled) { - cvm_server_init(); - cvm_server_start(); - } - - if (cfg2->mining_enabled) { + if (cfg->mining_enabled) { ESP_LOGI(TAG, "Mining subsystem enabled, initializing..."); mining_payment_init(); stratum_client_init(); - stratum_proxy_init(cfg2->mining_port); + stratum_proxy_init(cfg->mining_port); - if (cfg2->mining_payout_mode != MINING_PAYOUT_UPSTREAM) { + if (cfg->mining_payout_mode != MINING_PAYOUT_UPSTREAM) { stratum_client_start(); } -- cgit v1.2.3