upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/components/tollgate_core/include
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-20 02:20:15 +0530
committerYour Name <you@example.com>2026-05-20 02:20:15 +0530
commitf922e8a676431f33d6133fc021d384bbdfd76f17 (patch)
tree84d210d66d0969905496f23dfdd23f2429a11142 /components/tollgate_core/include
parentf4f85f938405867be89cfee029d5117cb1b4ac69 (diff)
feat: upgrade tollgate_core to full version with mining + stratum
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.
Diffstat (limited to 'components/tollgate_core/include')
-rw-r--r--components/tollgate_core/include/tollgate_core.h14
-rw-r--r--components/tollgate_core/include/tollgate_platform.h20
2 files changed, 34 insertions, 0 deletions
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 @@
7#include <stdbool.h> 7#include <stdbool.h>
8#include <stdint.h> 8#include <stdint.h>
9 9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
10esp_err_t tollgate_core_init(const tollgate_platform_t *platform, esp_ip4_addr_t ap_ip); 14esp_err_t tollgate_core_init(const tollgate_platform_t *platform, esp_ip4_addr_t ap_ip);
11 15
12esp_err_t tollgate_core_dns_start(esp_ip4_addr_t upstream_dns); 16esp_err_t tollgate_core_dns_start(esp_ip4_addr_t upstream_dns);
@@ -31,4 +35,14 @@ int tollgate_core_allowed_client_count(void);
31bool tollgate_core_is_owner(uint32_t client_ip); 35bool tollgate_core_is_owner(uint32_t client_ip);
32bool tollgate_core_is_owner_connected(void); 36bool tollgate_core_is_owner_connected(void);
33 37
38esp_err_t tollgate_core_stratum_proxy_init(uint16_t port);
39void tollgate_core_stratum_proxy_stop(void);
40void tollgate_core_on_share_accepted(uint32_t client_ip, double difficulty);
41double tollgate_core_calc_hashprice(double hashrate_ghs);
42char *tollgate_core_get_mining_status_json(void);
43
44#ifdef __cplusplus
45}
46#endif
47
34#endif 48#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 @@
4#include <stdint.h> 4#include <stdint.h>
5#include <stdbool.h> 5#include <stdbool.h>
6 6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
7typedef struct { 11typedef struct {
8 uint16_t (*get_price_sats)(void); 12 uint16_t (*get_price_sats)(void);
9 int32_t (*get_step_ms)(void); 13 int32_t (*get_step_ms)(void);
@@ -12,6 +16,22 @@ typedef struct {
12 int32_t (*get_step_bytes)(void); 16 int32_t (*get_step_bytes)(void);
13 int64_t (*get_time_ms)(void); 17 int64_t (*get_time_ms)(void);
14 bool (*spend_proofs)(const char *raw_token_json); 18 bool (*spend_proofs)(const char *raw_token_json);
19
20 const char * (*get_stratum_url)(void);
21 uint16_t (*get_stratum_port)(void);
22 const char * (*get_stratum_user)(void);
23 const char * (*get_stratum_pass)(void);
24 const char * (*get_stratum_fallback_url)(void);
25 uint16_t (*get_stratum_fallback_port)(void);
26 uint16_t (*get_mining_port)(void);
27 const char * (*get_mining_payout_mode)(void);
28 uint64_t (*get_hashprice_sats_per_ghs_day)(void);
29 void (*on_share_accepted)(double difficulty);
30 double (*get_hashrate)(void);
15} tollgate_platform_t; 31} tollgate_platform_t;
16 32
33#ifdef __cplusplus
34}
35#endif
36
17#endif 37#endif