diff --git a/include/constants.h b/include/constants.h index 1f445dc..20ae711 100644 --- a/include/constants.h +++ b/include/constants.h @@ -11,8 +11,8 @@ #define DIFFICULTY_ADJUSTMENT_INTERVAL 960 // Every 960 blocks (roughly every 24 hours with a 90 second block time) // Max adjustment per is x2. So if blocks are coming in too fast, the difficulty will at most double every 24 hours, and vice versa if they're coming in too slow. #define TARGET_BLOCK_TIME 90 // Target block time in seconds -#define INITIAL_DIFFICULTY 0x1f0c1422 // Default compact target used by Autolykos2 PoW (This is ridiculously low) -//#define INITIAL_DIFFICULTY 0x1d1b7c51 // This takes 90s on my machine with a single thread, good for testing +//#define INITIAL_DIFFICULTY 0x1f0c1422 // Default compact target used by Autolykos2 PoW (This is ridiculously low) +#define INITIAL_DIFFICULTY 0x1d1b7c51 // This takes 90s on my machine with a single thread, good for testing // Reward schedule acceleration: 1 means normal-speed progression. #define EMISSION_ACCELERATION_FACTOR 1ULL diff --git a/src/main.c b/src/main.c index 91075f7..cfc1a8c 100644 --- a/src/main.c +++ b/src/main.c @@ -223,18 +223,14 @@ int main(int argc, char* argv[]) { free(block); // chain stores blocks by value; transactions are owned by chain copy // Save chain after each mined block; NOTE: In reality, blocks will appear every ~90s, so this won't be a realistic bottleneck on the mainnet - // TEMP - if (Chain_Size(chain) % 100 == 0) { - printf("Saving chain at height %zu...\n", Chain_Size(chain)); - Chain_SaveToFile(chain, chainDataDir, currentSupply, currentReward); - } + printf("Saving chain at height %zu...\n", Chain_Size(chain)); + Chain_SaveToFile(chain, chainDataDir, currentSupply, currentReward); currentReward = CalculateBlockReward(currentSupply, chain); // Update the global currentReward for the next block - // TEST, disabled diff - //if (Chain_Size(chain) % DIFFICULTY_ADJUSTMENT_INTERVAL == 0) { - // difficultyTarget = Chain_ComputeNextTarget(chain, difficultyTarget); - //} + if (Chain_Size(chain) % DIFFICULTY_ADJUSTMENT_INTERVAL == 0) { + difficultyTarget = Chain_ComputeNextTarget(chain, difficultyTarget); + } } if (!Chain_SaveToFile(chain, chainDataDir, currentSupply, currentReward)) {