Skip to content

Commit

Permalink
fixup! fix(projection-typeorm): stake pools are activated at first re…
Browse files Browse the repository at this point in the history
…g+2 epoch
  • Loading branch information
mkazlauskas committed Mar 21, 2023
1 parent 19451f2 commit dd7091e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/projection-typeorm/src/sinks/stakePools.sink.ts
Expand Up @@ -159,6 +159,7 @@ const computeCertificateIdRange = (epochNo: Cardano.EpochNo, eraSummaries: EraSu
return { maxId, minId };
};

// Perf: we could add 'StakePoolEntity.firstPoolRegistration' to make this more efficient
const updatePoolStatusWhere = async (
where: {
firstRegisteredInEpoch: Cardano.EpochNo;
Expand All @@ -170,6 +171,7 @@ const updatePoolStatusWhere = async (
eraSummaries: EraSummary[];
}
) => {
if (where.firstRegisteredInEpoch < 0) return;
const { minId, maxId } = computeCertificateIdRange(where.firstRegisteredInEpoch, dependencies.eraSummaries);
const queryResult: Array<{ id: Cardano.PoolId }> = await dependencies.queryRunner.query(`
SELECT sp.id
Expand Down

0 comments on commit dd7091e

Please sign in to comment.