Finally implement the "sticky" chain node

This commit is contained in:
2025-10-25 13:45:40 +09:00
parent 4c09490f8a
commit e8febcf8d5
2 changed files with 68 additions and 18 deletions
+10 -2
View File
@@ -582,7 +582,7 @@ next_nonce(AccountID) ->
% {ok, #{"reason" := Reason}} -> {error, Reason};
% Error -> Error
% end.
case request(["/v3/accounts/", AccountID]) of
case request_sticky(["/v3/accounts/", AccountID]) of
{ok, #{"nonce" := Nonce}} -> {ok, Nonce + 1};
{ok, #{"reason" := "Account not found"}} -> {ok, 1};
{ok, #{"reason" := Reason}} -> {error, Reason};
@@ -729,7 +729,7 @@ tx_info(ID) ->
post_tx(Data) when is_binary(Data) ->
JSON = zj:binary_encode(#{tx => Data}),
request("/v3/transactions", JSON);
request_sticky("/v3/transactions", JSON);
post_tx(Data) when is_list(Data) ->
post_tx(list_to_binary(Data)).
@@ -841,6 +841,14 @@ status_chainends() ->
request("/v3/status/chain-ends").
request_sticky(Path) ->
hz_man:request_sticky(unicode:characters_to_list(Path)).
request_sticky(Path, Payload) ->
hz_man:request_sticky(unicode:characters_to_list(Path), Payload).
request(Path) ->
hz_man:request(unicode:characters_to_list(Path)).