mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
An empty database and an empty creation document was the one combination the three-way genesis check could not judge. Nothing delivered, nothing stored, so no view contradicted another and Initialize returned the binary's own default as the chain's genesis — the exact defect the check exists to remove, reached through the absence of its inputs rather than their conflict. A D-Chain's document is the dchain.json recorded in its P-Chain CreateChainTx and reaches the VM as InitializeRequest.GenesisBytes. An empty one therefore means the bytes did not arrive, which is a delivery failure, not a chain that has none. Founding is refused, and the refusal names the genesis it declined to use so the two cases are distinguishable in a log. Existing chains are untouched: this fires only when the database holds no chain at all. A chain already on disk that is handed no document still fails the stored-vs-expected comparison, as before, and one born under a build that kept no record still recovers from its own height-0 head. Nineteen tests founded chains with no document and now supply one; the four that model chains already on disk deliberately still supply none. Co-authored-by: Hanzo Dev <[email protected]>