global externs refactor, some tcp methods
This commit is contained in:
@@ -36,6 +36,7 @@ void Block_AddTransaction(block_t* block, signed_transaction_t* tx);
|
||||
void Block_RemoveTransaction(block_t* block, uint8_t* txHash);
|
||||
bool Block_HasValidProofOfWork(const block_t* block);
|
||||
bool Block_AllTransactionsValid(const block_t* block);
|
||||
bool Block_IsFullyValid(const block_t* block);
|
||||
void Block_ShutdownPowContext(void);
|
||||
void Block_Destroy(block_t* block);
|
||||
void Block_Print(const block_t* block);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <block/chain.h>
|
||||
#include <block/block.h>
|
||||
|
||||
extern uint64_t currentBlockHeight;
|
||||
#include <runtime_state.h>
|
||||
|
||||
// Nets
|
||||
#define MAX_CONS 32 // Some baseline for now
|
||||
@@ -56,11 +56,8 @@ extern uint64_t currentBlockHeight;
|
||||
|
||||
static const uint64_t M_CAP = 18446744073709551615ULL; // Max uint64
|
||||
static const uint64_t TAIL_EMISSION = 750000000000ULL; // 0.75 coins per block floor
|
||||
static uint64_t currentReward = 750000000000ULL; // Epoch reward cache for phase 3
|
||||
// No max supply. Instead of halving, it'll follow a more gradual, Monero-like emission curve.
|
||||
|
||||
static uint256_t currentSupply = {{0, 0, 0, 0}}; // Global variable to track total supply; updated with each block mined
|
||||
|
||||
// Phase 3: update once per effective epoch and keep a fixed per-block reward for that epoch.
|
||||
static inline uint64_t GetInflationRateReward(uint256_t currentSupply, blockchain_t* chain) {
|
||||
if (!chain || !chain->blocks) { return 0x00; } // Invalid
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
#include <dynarr.h>
|
||||
|
||||
#include <block/block.h>
|
||||
#include <block/chain.h>
|
||||
#include <block/transaction.h>
|
||||
|
||||
typedef struct {
|
||||
tcp_server_t* server;
|
||||
tcp_client_t outboundClients[MAX_CONS];
|
||||
|
||||
17
include/runtime_state.h
Normal file
17
include/runtime_state.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef RUNTIME_STATE_H
|
||||
#define RUNTIME_STATE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <uint256.h>
|
||||
|
||||
#include <block/chain.h>
|
||||
|
||||
extern uint64_t currentBlockHeight;
|
||||
extern blockchain_t* currentChain;
|
||||
extern uint256_t currentSupply;
|
||||
extern uint64_t currentReward;
|
||||
extern uint32_t difficultyTarget;
|
||||
extern const char* chainDataDir;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user