Skip to content
Snippets Groups Projects
Commit 59ded148 authored by Carles Barrobés's avatar Carles Barrobés
Browse files

Make genesis format compatible with different polkadot versions

parent cf58f06a
No related branches found
No related tags found
1 merge request!11Changes to reflect the upgrade of duniter to polkadot 1.6.0
...@@ -11,7 +11,9 @@ export async function saveGenesis(ctx: Ctx, block: Block) { ...@@ -11,7 +11,9 @@ export async function saveGenesis(ctx: Ctx, block: Block) {
ctx.log.info("Loading genesis"); ctx.log.info("Loading genesis");
// Read genesis json // Read genesis json
const genesis: Genesis = JSON.parse(readFileSync(path.resolve(process.cwd(), genesis_path)).toString()).genesis.runtimeAndCode.runtime; const genesisData = JSON.parse(readFileSync(path.resolve(process.cwd(), genesis_path)).toString()).genesis;
// Accomodate for versions of polkadot before and after 1.6.0:
const genesis: Genesis = genesisData.runtimeAndCode?.runtime || genesisData.runtimeGenesis.patch;
const accounts: Map<Address, Account> = new Map(); const accounts: Map<Address, Account> = new Map();
const identities: Map<IdtyIndex, Identity> = new Map(); const identities: Map<IdtyIndex, Identity> = new Map();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment