Skip to content

Commit

Permalink
dont show commission for closed validators
Browse files Browse the repository at this point in the history
  • Loading branch information
HarukaMa committed Sep 13, 2024
1 parent 6427c54 commit 86fb637
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def get_validators_range_at_height(self, height: int, start: int, end: int
async with conn.cursor() as cur:
try:
await cur.execute(
"SELECT chm.address, chm.stake, chm.commission FROM committee_history_member chm "
"SELECT chm.address, chm.stake, chm.commission, chm.is_open FROM committee_history_member chm "
"JOIN committee_history ch ON chm.committee_id = ch.id "
"WHERE ch.height = %s "
"ORDER BY chm.stake DESC "
Expand Down
1 change: 1 addition & 0 deletions webui/chain_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ async def validators_route(request: Request):
"stake": validator["stake"],
"uptime": validator["uptime"] * 100,
"commission": validator["commission"],
"open": validator["is_open"],
})
total_stake += validator["stake"]

Expand Down
2 changes: 1 addition & 1 deletion webui/templates/htmx/validators.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<td><span class="mono"><a href="/address?a={{ validator.address.address }}">{{ UIAddress(validator.address) }}</a></span></td>
<td>{{ validator.stake | format_aleo_credit | safe }}</td>
<td>{{ "%0.2f" | format(validator.stake / total_stake * 100) }}%</td>
<td>{{ validator.commission }}%</td>
<td>{% if validator.open %}{{ validator.commission }}%{% else %}<span data-tippy-content="Not open for staking">--</span>{% endif %}</td>
<td>{{ "%0.2f" | format(validator.uptime) }}%</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 86fb637

Please sign in to comment.