Finally implement the "sticky" chain node
This commit is contained in:
+10
-2
@@ -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)).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user