huge chain test, added 1.5% yearly inflation at 3.5 million blocks

This commit is contained in:
2026-03-30 23:46:22 +02:00
parent 6f595b86b6
commit 075793c24c
7 changed files with 116 additions and 26 deletions

View File

@@ -7,7 +7,6 @@
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <constants.h>
#include <uint256.h>
typedef struct {
@@ -24,8 +23,8 @@ bool Chain_IsValid(blockchain_t* chain);
void Chain_Wipe(blockchain_t* chain);
// I/O
bool Chain_SaveToFile(blockchain_t* chain, const char* dirpath, uint256_t currentSupply);
bool Chain_LoadFromFile(blockchain_t* chain, const char* dirpath, uint256_t* outCurrentSupply, uint32_t* outDifficultyTarget);
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);
// Difficulty
uint32_t Chain_ComputeNextTarget(blockchain_t* chain, uint32_t currentTarget);

View File

@@ -23,9 +23,20 @@ static inline bool Address_IsCoinbase(const uint8_t address[32]) {
// 178 bytes total for v1
typedef struct {
uint8_t version;
// Only one "input" sender address
uint8_t senderAddress[32];
uint8_t recipientAddress[32];
uint64_t amount;
// The "main" recepient address and amount. This is the only required output, and is used for calculating the transaction hash and signature.
uint8_t recipientAddress1[32];
uint64_t amount1;
// The "extra" recepient address and amount. This can safely be NULL/0 if not used and has multiple uses:
// - Sending zero: parital spend, sender keeps coins on the same address
// - Sending to a different address: normal spend, sender's coins move to a new address, e.g. change address
// - Private Transactions: Can nullify the whole original stealth address input (sender) and send change to a new stealth address (recipient 2) to obfuscate the transaction graph.
// Note that coinbase will have this as NULL/0 (for now, but we could have multiple payouts in the future)
uint8_t recipientAddress2[32];
uint64_t amount2;
uint64_t fee; // Rewarded to the miner; can be zero, but the miner may choose to ignore transactions with very low fees
uint8_t compressedPublicKey[33];
// Timestamp is dictated by the block