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

Commit

Permalink
Merge pull request #394 from helium/madninja/witnessed_update
Browse files Browse the repository at this point in the history
Update witnessed route
  • Loading branch information
madninja authored Dec 31, 2021
2 parents c8bb352 + 49ee76c commit 24e5010
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions priv/hotspots.sql
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@ with recent_transactions as (
and block >= $2
),
hotspot_witnessed as (
select actor as witnessed
select distinct(actor) as witnessed
from transaction_actors
where transaction_hash in (select transaction_hash from recent_transactions)
and actor_role = 'challengee'
and block >= $2
group by actor
)
:hotspot_select

Expand Down
4 changes: 2 additions & 2 deletions src/bh_route_hotspots.erl
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ handle('GET', [Address, <<"witnesses">>, <<"sum">>], Req) ->
Args = ?GET_ARGS([max_time, min_time, bucket], Req),
?MK_RESPONSE(get_witnesses_sum({hotspot, Address}, Args), block_time);
handle('GET', [Address, <<"witnessed">>], _Req) ->
?MK_RESPONSE(get_hotspot_list([{witnessed_for, Address}]), block_time);
?MK_RESPONSE(get_hotspot_list([{witnessed_for, Address}]), {block_time, 60});
handle('GET', [Address], _Req) ->
?MK_RESPONSE(get_hotspot(Address), block_time);
handle(_, _, _Req) ->
Expand Down Expand Up @@ -391,7 +391,7 @@ get_hotspot_list([{witnesses_for, Address}]) ->
Result = ?PREPARED_QUERY(?S_HOTSPOT_WITNESS_LIST, [Address, MinBlock]),
mk_hotspot_witness_list_from_result(Result);
get_hotspot_list([{witnessed_for, Address}]) ->
{ok, {_, {_MaxBlock, MinBlock}}} = bh_route_blocks:get_block_span(undefined, <<"-5 day">>),
{ok, {_, {_MaxBlock, MinBlock}}} = bh_route_blocks:get_block_span(undefined, <<"-3 day">>),
Result = ?PREPARED_QUERY(?S_HOTSPOT_WITNESSED_LIST, [Address, MinBlock]),
mk_hotspot_witness_list_from_result(Result);
get_hotspot_list([
Expand Down

0 comments on commit 24e5010

Please sign in to comment.