balance sheet stuff, added khash hashmaps

This commit is contained in:
2026-04-02 21:21:12 +02:00
parent b20ba9802e
commit df7787ed2d
10 changed files with 824 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
#include <string.h>
#include <uint256.h>
#include <storage/block_table.h>
#include <balance_sheet.h>
typedef struct {
DynArr* blocks;
@@ -25,7 +26,7 @@ void Chain_Wipe(blockchain_t* chain);
// I/O
bool Chain_SaveToFile(blockchain_t* chain, const char* dirpath, uint256_t currentSupply, uint64_t currentReward);
bool Chain_LoadFromFile(blockchain_t* chain, const char* dirpath, uint256_t* outCurrentSupply, uint32_t* outDifficultyTarget, uint64_t* outCurrentReward);
bool Chain_LoadFromFile(blockchain_t* chain, const char* dirpath, uint256_t* outCurrentSupply, uint32_t* outDifficultyTarget, uint64_t* outCurrentReward, uint8_t* outLastSavedHash);
// Difficulty
uint32_t Chain_ComputeNextTarget(blockchain_t* chain, uint32_t currentTarget);