diff options
| author | Your Name <you@example.com> | 2026-05-23 02:32:24 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-23 02:32:24 +0530 |
| commit | 6771956f1647f377007ab61a59b116de6d536706 (patch) | |
| tree | e8b6c74164040339134e33b8616c27c23ec1ade6 /tests/unit/test_tollgate_client_mining | |
| parent | 10c69b0ddc34a1fafada3f8b68a622b4aa2bea77 (diff) | |
feat: create tollgate_core standalone C library + tollgate_esp IDF component
Phase 1-4: Extract core business logic into reusable library
tollgate_core/ — standalone C library (zero ESP-IDF deps):
- tollgate_core.c — orchestrator (init, process_payment, process_share, tick)
- tollgate_cashu.c — V3 token decode, checkstate via platform callback, allotment math
- tollgate_session.c — session lifecycle state machine (create/find/revoke/extend)
- tollgate_firewall.c — client allowlist, NAT filter, packet filter
- tollgate_mining.c — hashprice, nbits→difficulty, shares-to-allotment, client stats
components/tollgate_esp/ — ESP-IDF component wrapper:
- tollgate_esp_platform.c — implements tollgate_platform_t using ESP-IDF APIs
- CMakeLists.txt — compiles tollgate_core + ESP wrapper, links to ESP-IDF
- idf_component.yml — for IDF Component Registry
Platform interface (tollgate_platform.h):
- Config access: price, step_size, mint_url, metric
- Time: get_time_ms (via FreeRTOS ticks on ESP)
- Logging: log_info/warn/error (via ESP_LOG on ESP)
- Wallet: receive/send/balance (via nucula on ESP)
- HTTP: http_post (via esp_http_client on ESP)
- WiFi/MAC: mac_for_ip, napt_enable
- Mining: stratum config, hashprice override
Build verification:
- tollgate_core compiles standalone: cmake + make (gcc, host)
- tollgate_esp + ESP-IDF full build: passes (idf.py build)
- Unit tests: 22/22 pass (make test-unit)
- No behavioral change to existing main/ code yet (Phase 5)
Diffstat (limited to 'tests/unit/test_tollgate_client_mining')
| -rwxr-xr-x | tests/unit/test_tollgate_client_mining | bin | 0 -> 48448 bytes |
1 files changed, 0 insertions, 0 deletions
diff --git a/tests/unit/test_tollgate_client_mining b/tests/unit/test_tollgate_client_mining new file mode 100755 index 0000000..d331bd1 --- /dev/null +++ b/tests/unit/test_tollgate_client_mining | |||
| Binary files differ | |||