Skip to content

Commit d9eff0d

Browse files
authored
Merge pull request #4088 from IntersectMBO/issue-4059
Fix SQL counting the number of active CC members
2 parents 6609a59 + 7cb2557 commit d9eff0d

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

govtool/backend/sql/get-network-metrics.sql

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,12 @@ CurrentEpoch AS (
2323
),
2424
CommitteeMembers AS (
2525
SELECT DISTINCT ON (cm.committee_hash_id)
26-
cr.id,
27-
block.time,
28-
encode(cold_key_hash.raw, 'hex') cold_key,
29-
encode(hot_key_hash.raw, 'hex') hot_key
30-
FROM committee_registration cr
31-
JOIN tx ON tx.id = cr.tx_id
32-
JOIN block ON block.id = tx.block_id
33-
JOIN committee_hash cold_key_hash ON cr.cold_key_id = cold_key_hash.id
34-
JOIN committee_hash hot_key_hash ON cr.hot_key_id = hot_key_hash.id
35-
JOIN committee_member cm ON cm.committee_hash_id = cold_key_hash.id OR cm.committee_hash_id = hot_key_hash.id
36-
LEFT JOIN committee_de_registration cdr ON cdr.cold_key_id = cold_key_hash.id
26+
cm.id,
27+
cm.expiration_epoch
28+
FROM committee_member cm
3729
CROSS JOIN CurrentEpoch
3830
WHERE
39-
cdr.id IS NULL AND cm.expiration_epoch > CurrentEpoch.no
31+
cm.expiration_epoch >= CurrentEpoch.no
4032
),
4133
NoOfCommitteeMembers AS (
4234
SELECT COUNT(*) total FROM CommitteeMembers

0 commit comments

Comments
 (0)