Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
Add hotspot and validator counts to account details (#407)
Browse files Browse the repository at this point in the history
* Add hotspot/validator count to account details
  • Loading branch information
madninja committed Jan 25, 2022
1 parent 53e4ffa commit c25831c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions priv/accounts.sql
Expand Up @@ -49,6 +49,8 @@ where (l.address > $1 and l.first_block = $2) or (l.first_block < $2)

-- :account_speculative_extend
, l.first_block
, (select count(*) from gateway_inventory where owner = l.address) as hotspot_count
, (select count(*) from validator_inventory where owner = l.address) as validator_count
, (select greatest(l.nonce, coalesce(max(p.nonce), l.nonce))
from pending_transactions p
where p.address = l.address and nonce_type='balance' and status != 'failed'
Expand Down
6 changes: 4 additions & 2 deletions src/bh_route_accounts.erl
Expand Up @@ -315,13 +315,15 @@ account_to_json(
};
account_to_json(
{Height, Address, DCBalance, DCNonce, SecBalance, SecNonce, Balance, StakedBalance, Nonce,
FirstBlock, SpecNonce, SpecSecNonce}
FirstBlock, HotspotCount, ValidatorCount, SpecNonce, SpecSecNonce}
) ->
Base = account_to_json(
{Height, Address, DCBalance, DCNonce, SecBalance, SecNonce, Balance, StakedBalance, Nonce,
FirstBlock}
),
Base#{
<<"speculative_nonce">> => SpecNonce,
<<"speculative_sec_nonce">> => SpecSecNonce
<<"speculative_sec_nonce">> => SpecSecNonce,
<<"hotspot_count">> => HotspotCount,
<<"validator_count">> => ValidatorCount
}.

0 comments on commit c25831c

Please sign in to comment.