Catch HZ timeout on balance check

This commit is contained in:
2025-12-30 16:33:32 +09:00
parent 52994a12cb
commit 99669a50c7
5 changed files with 302 additions and 4 deletions
+4 -4
View File
@@ -641,11 +641,12 @@ do_refresh2(ChainID, State = #s{wallet = W = #wallet{poas = POAs}}) ->
check_balance(ChainID) ->
fun(This = #poa{id = ID}) ->
fun(This = #poa{id = ID, balances = [OldBalance]}) ->
Pucks =
case hz:acc(ID) of
{ok, #{"balance" := P}} -> P;
{error, "Account not found"} -> 0
{error, "Account not found"} -> 0;
{error, timeout} -> OldBalance
end,
Dist = [{ChainID, Pucks}],
Gaju = #balance{coin = "gaju", total = Pucks, dist = Dist},
@@ -655,7 +656,6 @@ check_balance(ChainID) ->
ensure_hz_set(Node = #node{ip = IP, external = Port}) ->
tell("Ensuring hz is set..."),
case hz:chain_nodes() of
[{IP, Port}] ->
case hz:status() of
@@ -1078,7 +1078,7 @@ do_drop_key(ID, State = #s{wallet = W, wallets = Wallets, pass = Pass}) ->
do_open_wallet(Path, Phrase, State) ->
Pass = pass(Phrase),
case read(Path, Pass) of
{ok, Recovered = #wallet{name = Name, poas = POAs, endpoint = Node}} ->
{ok, Recovered = #wallet{name = Name, poas = POAs, endpoint = _Node}} ->
ok = gd_gui:show(POAs),
ok = gd_gui:wallet(Name),
% TODO: set_hz/1 should dispatch async to the gd_netman.