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

Commit

Permalink
Merge pull request #79 from helium/madninja/unadded_gateway
Browse files Browse the repository at this point in the history
Handle un-added gateway in state channel summary
  • Loading branch information
madninja authored Jul 23, 2020
2 parents 76e318f + 0d40eec commit e111bac
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/be_txn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ to_json(<<"state_channel_close_v1">>, Json=#{ state_channel := SCJson } , Ledger

UpdateSummary =
fun(Summary=#{ client := Client }) ->
{ok, ClientInfo} = blockchain_ledger_v1:find_gateway_info(?B58_TO_BIN(Client), Ledger),
ClientLoc = blockchain_ledger_gateway_v2:location(ClientInfo),
Summary#{
owner => ?BIN_TO_B58(blockchain_ledger_gateway_v2:owner_address(ClientInfo)),
location => ?MAYBE_H3(ClientLoc)
}
case blockchain_ledger_v1:find_gateway_info(?B58_TO_BIN(Client), Ledger) of
{error, _} -> Summary;
{ok, ClientInfo} ->
blockchain_ledger_v1:find_gateway_info(?B58_TO_BIN(Client), Ledger),
ClientLoc = blockchain_ledger_gateway_v2:location(ClientInfo),
Summary#{
owner => ?BIN_TO_B58(blockchain_ledger_gateway_v2:owner_address(ClientInfo)),
location => ?MAYBE_H3(ClientLoc)
}
end
end,

Json#{
Expand Down

0 comments on commit e111bac

Please sign in to comment.