Skip to content

Commit

Permalink
fix: dont attempt to pull governance data if on simulator or testnet
Browse files Browse the repository at this point in the history
MichaelTaylor3D committed May 27, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
MichaelTaylor3D Michael Taylor
1 parent ebd280f commit f2ff47e
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/models/governance/governance.model.js
Original file line number Diff line number Diff line change
@@ -84,9 +84,12 @@ class Governance extends Model {
confirmed: true,
});
} else if (USE_SIMULATOR || CHIA_NETWORK === 'testnet') {
// this block is just a fallback if the app gets through the upstream checks,
// might be unnecessary
logger.info('SIMULATOR/TESTNET MODE: Using sample picklist');
updates.push({
metaKey: 'pickList',
metaValue: PickListStub,
metaValue: JSON.stringify(PickListStub),
confirmed: true,
});
}
@@ -100,6 +103,18 @@ class Governance extends Model {
throw new Error('Missing information in env to sync Governance data');
}

// If on simulator or testnet, use the stubbed picklist data and return
if (USE_SIMULATOR || CHIA_NETWORK === 'testnet') {
logger.info('SIMULATOR/TESTNET MODE: Using sample picklist');
Governance.upsert({
metaKey: 'pickList',
metaValue: JSON.stringify(PickListStub),
confirmed: true,
});

return;
}

const governanceData = await datalayer.getSubscribedStoreData(
GOVERANCE_BODY_ID,
GOVERNANCE_BODY_IP,
@@ -125,12 +140,6 @@ class Governance extends Model {
);

await Governance.upsertGovernanceDownload(versionedGovernanceData);
} else if (USE_SIMULATOR || CHIA_NETWORK === 'testnet') {
Governance.upsert({
metaKey: 'pickList',
metaValue: PickListStub,
confirmed: true,
});
} else {
throw new Error(
`Governance data is not available from this source for ${dataModelVersion} data model.`,

0 comments on commit f2ff47e

Please sign in to comment.