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:
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