upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tollgate_core/src/tollgate_mining.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-23 04:50:26 +0530
committerYour Name <you@example.com>2026-05-23 04:50:26 +0530
commit9330b01c28aebc865a3c0a51df8730196cb4152e (patch)
tree60c3ae35b2550c737c228e81fd342c8d07af11af /tollgate_core/src/tollgate_mining.h
parent851801f50f1282ab1db5f8a241dbd245f59e447e (diff)
Phase 6a-6d: Consolidate and clean up
6a: Delete dead standalone tollgate_core/ (12 files, never compiled) 6b: Rewrite dns_server.c as thin shim to component's tollgate_core_dns - Fix component DNS to bind to AP IP instead of INADDR_ANY 6c: Rewrite stratum_proxy.c as thin shim with struct cast to component types 6d: Move sandbox logic into component's tollgate_core_firewall - Add tollgate_core_fw_set_sandbox_ports/set_sandbox_mint_access - Add is_sandbox_allowed() to component's ip4_canforward_filter - Clean main/firewall.c to delegate filter to component - Remove redundant DNS auth double-calls from main firewall Add ROADMAP.md with full extraction plan and checklists All 21 unit tests pass. ESP-IDF build passes.
Diffstat (limited to 'tollgate_core/src/tollgate_mining.h')
-rw-r--r--tollgate_core/src/tollgate_mining.h34
1 files changed, 0 insertions, 34 deletions
diff --git a/tollgate_core/src/tollgate_mining.h b/tollgate_core/src/tollgate_mining.h
deleted file mode 100644
index 39681a5..0000000
--- a/tollgate_core/src/tollgate_mining.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef TOLLGATE_CORE_MINING_H
2#define TOLLGATE_CORE_MINING_H
3
4#include <stdint.h>
5#include <stdbool.h>
6
7#define TG_MINING_SHARE_WINDOW_S 30
8#define TG_MINING_BLOCK_SUBSIDY_SATS 312500000ULL
9#define TG_MINING_BLOCKS_PER_DAY 144ULL
10#define TG_MINING_MAX_CLIENTS 10
11
12typedef struct {
13 uint32_t ip;
14 uint64_t shares_accepted;
15 uint64_t shares_rejected;
16 int64_t first_share_time_ms;
17 int64_t last_share_time_ms;
18 double hashrate_ghs;
19} tg_mining_client_stats_t;
20
21uint64_t tg_mining_nbits_to_difficulty(uint32_t nbits);
22double tg_mining_calculate_hashprice(uint32_t nbits);
23double tg_mining_calculate_hashprice_override(uint64_t sats_per_ghs_day);
24int tg_mining_validate_share(const uint8_t *header80, uint32_t nonce, const uint8_t *target, int target_len);
25uint64_t tg_mining_shares_to_allotment_ms(double hashrate_ghs, double hashprice, int price, int step_ms);
26uint64_t tg_mining_shares_to_allotment_bytes(double hashrate_ghs, double hashprice, int price, int step_bytes);
27tg_mining_client_stats_t *tg_mining_get_or_create_client(uint32_t client_ip);
28void tg_mining_update_hashrate(uint32_t client_ip, bool accepted);
29const tg_mining_client_stats_t *tg_mining_get_client_stats(uint32_t client_ip);
30double tg_mining_get_current_hashprice(void);
31void tg_mining_set_current_nbits(uint32_t nbits);
32void tg_mining_init(void);
33
34#endif