From f922e8a676431f33d6133fc021d384bbdfd76f17 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 May 2026 02:20:15 +0530 Subject: feat: upgrade tollgate_core to full version with mining + stratum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace skeleton tollgate_core (9 files, 7 callbacks) with full version from feature/miner-integration (13 files, 22 callbacks): New modules: - tollgate_core_mining.c/h — mining payment session management - tollgate_core_stratum_proxy.c/h — SV1 stratum proxy Updated: - tollgate_core.h — extern C guards, 5 new mining API functions - tollgate_platform.h — extern C guards, 22 platform callbacks (was 7) - tollgate_core_firewall.c — conditional CONFIG_LWIP_IPV4_NAPT - CMakeLists.txt — mining + stratum source files Also adds MINER_INTEGRATION_PLAN.md from the feature branch. --- components/tollgate_core/include/tollgate_core.h | 14 ++++++++++++++ components/tollgate_core/include/tollgate_platform.h | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'components/tollgate_core/include') diff --git a/components/tollgate_core/include/tollgate_core.h b/components/tollgate_core/include/tollgate_core.h index c47ebeb..6a17cbd 100644 --- a/components/tollgate_core/include/tollgate_core.h +++ b/components/tollgate_core/include/tollgate_core.h @@ -7,6 +7,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + esp_err_t tollgate_core_init(const tollgate_platform_t *platform, esp_ip4_addr_t ap_ip); esp_err_t tollgate_core_dns_start(esp_ip4_addr_t upstream_dns); @@ -31,4 +35,14 @@ int tollgate_core_allowed_client_count(void); bool tollgate_core_is_owner(uint32_t client_ip); bool tollgate_core_is_owner_connected(void); +esp_err_t tollgate_core_stratum_proxy_init(uint16_t port); +void tollgate_core_stratum_proxy_stop(void); +void tollgate_core_on_share_accepted(uint32_t client_ip, double difficulty); +double tollgate_core_calc_hashprice(double hashrate_ghs); +char *tollgate_core_get_mining_status_json(void); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/components/tollgate_core/include/tollgate_platform.h b/components/tollgate_core/include/tollgate_platform.h index f60f1f9..79e25cf 100644 --- a/components/tollgate_core/include/tollgate_platform.h +++ b/components/tollgate_core/include/tollgate_platform.h @@ -4,6 +4,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { uint16_t (*get_price_sats)(void); int32_t (*get_step_ms)(void); @@ -12,6 +16,22 @@ typedef struct { int32_t (*get_step_bytes)(void); int64_t (*get_time_ms)(void); bool (*spend_proofs)(const char *raw_token_json); + + const char * (*get_stratum_url)(void); + uint16_t (*get_stratum_port)(void); + const char * (*get_stratum_user)(void); + const char * (*get_stratum_pass)(void); + const char * (*get_stratum_fallback_url)(void); + uint16_t (*get_stratum_fallback_port)(void); + uint16_t (*get_mining_port)(void); + const char * (*get_mining_payout_mode)(void); + uint64_t (*get_hashprice_sats_per_ghs_day)(void); + void (*on_share_accepted)(double difficulty); + double (*get_hashrate)(void); } tollgate_platform_t; +#ifdef __cplusplus +} +#endif + #endif -- cgit v1.2.3