recompute state bug fixed

This commit is contained in:
2026-05-29 13:51:34 +02:00
parent 763aeb648f
commit 39293029c5
3 changed files with 10 additions and 1 deletions
+5
View File
@@ -698,6 +698,11 @@ int main(int argc, char* argv[]) {
uint8_t lastSavedHash[32] = {0};
if (!Chain_LoadFromFile(chain, chainDataDir, &currentSupply, &difficultyTarget, &currentReward, lastSavedHash, false)) {
printf("No existing chain loaded from %s\n", chainDataDir);
} else {
// Recompute runtime supply/reward from loaded blocks to avoid trusting stale meta values.
if (!Chain_RecomputeRuntimeState(chain)) {
fprintf(stderr, "Failed to recompute runtime state from loaded chain\n");
}
}
if (!BalanceSheet_LoadFromFile(chainDataDir)) {