diff options
| author | Your Name <you@example.com> | 2026-05-19 12:55:28 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-19 12:55:28 +0530 |
| commit | 473b4d1108d8dc9264c44de587121e6886b08a5d (patch) | |
| tree | 2812e2550c4520137127baca2ed7da2a90b47165 | |
| parent | beb73a2eeacf7dbe5e292ce6e26a95a933808267 (diff) | |
fix: build errors in cvm_server, stratum_proxy, sw_miner + nucula visibility
- cvm_server: replace esp_timer_get_time() with xTaskGetTickCount(), fix
process_relay_message() call signature (3 args -> 2)
- stratum_proxy: widen task_name buffer from 16 to 20 chars
- sw_miner: add missing #include esp_random.h
- nucula_src: save_proofs() moved to public in wallet.hpp
- CMakeLists: ensure tcp_transport in REQUIRES
- tollgate_main: add display.h, local_relay.h, relay_selector.h, sync_manager.h includes
- Build now succeeds: 1.2MB binary, 70% partition free
| -rw-r--r-- | main/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | main/cvm_server.c | 6 | ||||
| -rw-r--r-- | main/stratum_proxy.c | 2 | ||||
| -rw-r--r-- | main/sw_miner.c | 1 | ||||
| -rw-r--r-- | main/tollgate_main.c | 4 | ||||
| -rwxr-xr-x | tests/unit/test_cvm_server | bin | 0 -> 45720 bytes | |||
| -rwxr-xr-x | tests/unit/test_geohash | bin | 20776 -> 20784 bytes | |||
| -rwxr-xr-x | tests/unit/test_identity | bin | 297880 -> 297888 bytes | |||
| -rwxr-xr-x | tests/unit/test_lightning_payout | bin | 20552 -> 20552 bytes | |||
| -rwxr-xr-x | tests/unit/test_lnurl_pay | bin | 21304 -> 21312 bytes | |||
| -rwxr-xr-x | tests/unit/test_mcp_handler | bin | 38736 -> 64152 bytes | |||
| -rwxr-xr-x | tests/unit/test_mining_payment | bin | 0 -> 28672 bytes | |||
| -rwxr-xr-x | tests/unit/test_nip04 | bin | 298776 -> 298784 bytes | |||
| -rwxr-xr-x | tests/unit/test_tollgate_client | bin | 51992 -> 52968 bytes |
14 files changed, 16 insertions, 5 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index df52a3c..555cb74 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt | |||
| @@ -16,6 +16,11 @@ idf_component_register(SRCS "tollgate_main.c" | |||
| 16 | "nip04.c" | 16 | "nip04.c" |
| 17 | "mcp_handler.c" | 17 | "mcp_handler.c" |
| 18 | "cvm_server.c" | 18 | "cvm_server.c" |
| 19 | "display.c" | ||
| 20 | "font.c" | ||
| 21 | "local_relay.c" | ||
| 22 | "relay_selector.c" | ||
| 23 | "sync_manager.c" | ||
| 19 | "mining_payment.c" | 24 | "mining_payment.c" |
| 20 | "stratum_client.c" | 25 | "stratum_client.c" |
| 21 | "stratum_proxy.c" | 26 | "stratum_proxy.c" |
| @@ -24,5 +29,6 @@ idf_component_register(SRCS "tollgate_main.c" | |||
| 24 | INCLUDE_DIRS "." | 29 | INCLUDE_DIRS "." |
| 25 | REQUIRES esp_wifi esp_event esp_netif nvs_flash esp_http_server | 30 | REQUIRES esp_wifi esp_event esp_netif nvs_flash esp_http_server |
| 26 | lwip json esp_http_client mbedtls esp-tls log spiffs | 31 | lwip json esp_http_client mbedtls esp-tls log spiffs |
| 27 | nucula_lib secp256k1 esp_timer tcp_transport | 32 | nucula_lib secp256k1 axs15231b qrcode wisp_relay |
| 33 | esp_timer tcp_transport | ||
| 28 | PRIV_REQUIRES esp-tls) | 34 | PRIV_REQUIRES esp-tls) |
diff --git a/main/cvm_server.c b/main/cvm_server.c index 644738b..9e22d53 100644 --- a/main/cvm_server.c +++ b/main/cvm_server.c | |||
| @@ -556,7 +556,7 @@ static void cvm_relay_task(void *arg) | |||
| 556 | return; | 556 | return; |
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | int64_t last_ping_time = (int64_t)esp_timer_get_time() / 1000000; | 559 | int64_t last_ping_time = (int64_t)(xTaskGetTickCount() * portTICK_PERIOD_MS) / 1000; |
| 560 | int consecutive_timeouts = 0; | 560 | int consecutive_timeouts = 0; |
| 561 | 561 | ||
| 562 | while (g_running) { | 562 | while (g_running) { |
| @@ -576,7 +576,7 @@ static void cvm_relay_task(void *arg) | |||
| 576 | char *text = parse_ws_text_frame(buf, rlen); | 576 | char *text = parse_ws_text_frame(buf, rlen); |
| 577 | if (text) { | 577 | if (text) { |
| 578 | if (strlen(text) > 0) { | 578 | if (strlen(text) > 0) { |
| 579 | process_relay_message(tls, relay_url, text); | 579 | process_relay_message(relay_url, text); |
| 580 | } | 580 | } |
| 581 | free(text); | 581 | free(text); |
| 582 | } | 582 | } |
| @@ -590,7 +590,7 @@ static void cvm_relay_task(void *arg) | |||
| 590 | } | 590 | } |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | int64_t now = (int64_t)esp_timer_get_time() / 1000000; | 593 | int64_t now = (int64_t)(xTaskGetTickCount() * portTICK_PERIOD_MS) / 1000; |
| 594 | if (now - last_ping_time >= CVM_WS_PING_INTERVAL_S) { | 594 | if (now - last_ping_time >= CVM_WS_PING_INTERVAL_S) { |
| 595 | uint8_t ping[2] = {0x89, 0x00}; | 595 | uint8_t ping[2] = {0x89, 0x00}; |
| 596 | esp_tls_conn_write(tls, ping, 2); | 596 | esp_tls_conn_write(tls, ping, 2); |
diff --git a/main/stratum_proxy.c b/main/stratum_proxy.c index 278f8f3..288c633 100644 --- a/main/stratum_proxy.c +++ b/main/stratum_proxy.c | |||
| @@ -96,7 +96,7 @@ static void proxy_server_task(void *arg) | |||
| 96 | if (client_fd < 0) continue; | 96 | if (client_fd < 0) continue; |
| 97 | 97 | ||
| 98 | s_stats.active_miners++; | 98 | s_stats.active_miners++; |
| 99 | char task_name[16]; | 99 | char task_name[20]; |
| 100 | snprintf(task_name, sizeof(task_name), "miner_%d", client_fd); | 100 | snprintf(task_name, sizeof(task_name), "miner_%d", client_fd); |
| 101 | xTaskCreate(proxy_client_handler, task_name, 4096, (void *)(intptr_t)client_fd, 3, NULL); | 101 | xTaskCreate(proxy_client_handler, task_name, 4096, (void *)(intptr_t)client_fd, 3, NULL); |
| 102 | } | 102 | } |
diff --git a/main/sw_miner.c b/main/sw_miner.c index b45e7c5..cdd98a0 100644 --- a/main/sw_miner.c +++ b/main/sw_miner.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include "mining_payment.h" | 4 | #include "mining_payment.h" |
| 5 | #include "config.h" | 5 | #include "config.h" |
| 6 | #include "esp_log.h" | 6 | #include "esp_log.h" |
| 7 | #include "esp_random.h" | ||
| 7 | #include "mbedtls/sha256.h" | 8 | #include "mbedtls/sha256.h" |
| 8 | #include "freertos/FreeRTOS.h" | 9 | #include "freertos/FreeRTOS.h" |
| 9 | #include "freertos/task.h" | 10 | #include "freertos/task.h" |
diff --git a/main/tollgate_main.c b/main/tollgate_main.c index 30a63db..e4cea42 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 | #include "stratum_client.h" | 30 | #include "stratum_client.h" |
| 27 | #include "stratum_proxy.h" | 31 | #include "stratum_proxy.h" |
| 28 | #include "sw_miner.h" | 32 | #include "sw_miner.h" |
diff --git a/tests/unit/test_cvm_server b/tests/unit/test_cvm_server new file mode 100755 index 0000000..bd5e735 --- /dev/null +++ b/tests/unit/test_cvm_server | |||
| Binary files differ | |||
diff --git a/tests/unit/test_geohash b/tests/unit/test_geohash index dc5045f..7e27b60 100755 --- a/tests/unit/test_geohash +++ b/tests/unit/test_geohash | |||
| Binary files differ | |||
diff --git a/tests/unit/test_identity b/tests/unit/test_identity index 277bb49..4dc9cd5 100755 --- a/tests/unit/test_identity +++ b/tests/unit/test_identity | |||
| Binary files differ | |||
diff --git a/tests/unit/test_lightning_payout b/tests/unit/test_lightning_payout index b10888c..caa9626 100755 --- a/tests/unit/test_lightning_payout +++ b/tests/unit/test_lightning_payout | |||
| Binary files differ | |||
diff --git a/tests/unit/test_lnurl_pay b/tests/unit/test_lnurl_pay index 1f16293..1345004 100755 --- a/tests/unit/test_lnurl_pay +++ b/tests/unit/test_lnurl_pay | |||
| Binary files differ | |||
diff --git a/tests/unit/test_mcp_handler b/tests/unit/test_mcp_handler index b5d6a85..b7b1518 100755 --- a/tests/unit/test_mcp_handler +++ b/tests/unit/test_mcp_handler | |||
| Binary files differ | |||
diff --git a/tests/unit/test_mining_payment b/tests/unit/test_mining_payment new file mode 100755 index 0000000..015deaf --- /dev/null +++ b/tests/unit/test_mining_payment | |||
| Binary files differ | |||
diff --git a/tests/unit/test_nip04 b/tests/unit/test_nip04 index cb52040..daf5e16 100755 --- a/tests/unit/test_nip04 +++ b/tests/unit/test_nip04 | |||
| Binary files differ | |||
diff --git a/tests/unit/test_tollgate_client b/tests/unit/test_tollgate_client index f9b0f7d..02f7226 100755 --- a/tests/unit/test_tollgate_client +++ b/tests/unit/test_tollgate_client | |||
| Binary files differ | |||