diff options
| author | Your Name <you@example.com> | 2026-05-19 04:10:12 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 04:10:12 +0530 |
| commit | 2d78aadfd603fab9a9342b1281ad1d46ad82cf1d (patch) | |
| tree | 3e8875b7e0301ac6634548e186542e2d67a68f34 /main/tollgate_main.c | |
| parent | abee221b0f0e5a4513ab126afbdfddc2728df6be (diff) | |
feat: relay hardening — restore build, add tests, negentropy adapter
Restores build broken by eeb9d2d (cvm-relay-stability removed deps):
- CMakeLists.txt: restore display.c, font.c, local_relay.c, relay_selector.c, sync_manager.c, axs15231b, qrcode, wisp_relay
- tollgate_main.c: restore display.h, local_relay.h, relay_selector.h, sync_manager.h includes and display calls
- cvm_server.c: kept master's keepalive/timeout/ping-pong fixes
New test infrastructure:
- test-local-relay, test-relay-nip11, test-cvm-roundtrip, test-cvm-mcp, test-cross-board make targets
- test-cvm-roundtrip.mjs: MCP get_config + get_balance via public relay
- test-cross-board.mjs: cross-board payment test
- test-cvm-mcp-relay.mjs: kept from master
New unit tests (35 tests):
- test_display.c: 22 tests for escape_wifi_field
- test_negentropy_adapter.c: 13 tests for negentropy adapter
New modules:
- negentropy_adapter.c/h: NIP-77 adapter skeleton
Docs:
- AGENTS.md: display module docs, new test commands
- RELAY_HARDENING_PLAN.md: hardening checklist
- RELAY_HARDENING_MERGE.md: merge plan and checklist
Cleanup:
- Removed CHECKLIST-CVM-RELAY.md, PLAN-SQUASH-MERGE.md (stale planning docs)
- Removed components/esp-miner submodule
Host unit tests: 63/63 pass
Diffstat (limited to 'main/tollgate_main.c')
| -rw-r--r-- | main/tollgate_main.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/main/tollgate_main.c b/main/tollgate_main.c index fa7a692..4741765 100644 --- a/main/tollgate_main.c +++ b/main/tollgate_main.c | |||
| @@ -23,6 +23,10 @@ | |||
| 23 | #include "tollgate_client.h" | 23 | #include "tollgate_client.h" |
| 24 | #include "lightning_payout.h" | 24 | #include "lightning_payout.h" |
| 25 | #include "cvm_server.h" | 25 | #include "cvm_server.h" |
| 26 | #include "display.h" | ||
| 27 | #include "local_relay.h" | ||
| 28 | #include "relay_selector.h" | ||
| 29 | #include "sync_manager.h" | ||
| 26 | 30 | ||
| 27 | #define MAX_STA_RETRY 5 | 31 | #define MAX_STA_RETRY 5 |
| 28 | static const char *TAG = "tollgate_main"; | 32 | static const char *TAG = "tollgate_main"; |
| @@ -178,6 +182,11 @@ static void start_services(void) | |||
| 178 | s_services_running = true; | 182 | s_services_running = true; |
| 179 | if (s_services_mutex) xSemaphoreGive(s_services_mutex); | 183 | if (s_services_mutex) xSemaphoreGive(s_services_mutex); |
| 180 | ESP_LOGI(TAG, "=== TollGate services started ==="); | 184 | ESP_LOGI(TAG, "=== TollGate services started ==="); |
| 185 | |||
| 186 | display_set_state(DISPLAY_READY); | ||
| 187 | char portal_url[128]; | ||
| 188 | snprintf(portal_url, sizeof(portal_url), "http://%s/", cfg->ap_ip_str); | ||
| 189 | display_update(cfg->ap_ssid, 0, 0, portal_url); | ||
| 181 | } | 190 | } |
| 182 | 191 | ||
| 183 | static void stop_services(void) | 192 | static void stop_services(void) |
| @@ -261,6 +270,9 @@ void app_main(void) | |||
| 261 | { | 270 | { |
| 262 | ESP_LOGI(TAG, "=== TollGate ESP32 Starting ==="); | 271 | ESP_LOGI(TAG, "=== TollGate ESP32 Starting ==="); |
| 263 | 272 | ||
| 273 | display_init(); | ||
| 274 | display_set_state(DISPLAY_BOOT); | ||
| 275 | |||
| 264 | esp_err_t ret = nvs_flash_init(); | 276 | esp_err_t ret = nvs_flash_init(); |
| 265 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { | 277 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { |
| 266 | ESP_ERROR_CHECK(nvs_flash_erase()); | 278 | ESP_ERROR_CHECK(nvs_flash_erase()); |