Skip to content

Commit

Permalink
fixup! test: get tests to pass without setting NONCE_LIMITER_RESET_FR…
Browse files Browse the repository at this point in the history
…EQUENCY
  • Loading branch information
JamesPiechota committed Dec 24, 2024
1 parent 5713fed commit 645160c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
1 change: 1 addition & 0 deletions apps/arweave/src/ar_node.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ get_block_index() ->
%% initialized the state.
get_current_block() ->
[{_, Current}] = ets:lookup(node_state, current),
?LOG_ERROR([{event, get_current_block}, {current, ar_util:encode(Current)}]),
ar_block_cache:get(block_cache, Current).

%% @doc Return the current network difficulty. Assume the node has joined the network and
Expand Down
40 changes: 20 additions & 20 deletions apps/arweave/src/ar_nonce_limiter_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ start_link() ->
%% ===================================================================

init([]) ->
case ar_config:is_vdf_server() of
false ->
ignore;
{ok, Config} = application:get_env(arweave, config),
ServerWorkers = lists:map(
fun(Peer) ->
Name = list_to_atom("ar_nonce_limiter_server_worker_"
++ ar_util:peer_to_str(Peer)),
?CHILD_WITH_ARGS(ar_nonce_limiter_server_worker,
worker, Name, [Name, Peer])
end,
Config#config.nonce_limiter_client_peers
),
Client = ?CHILD(ar_nonce_limiter_client, worker),
Server = ?CHILD(ar_nonce_limiter_server, worker),
NonceLimiter = ?CHILD(ar_nonce_limiter, worker),

Workers = case ar_config:is_vdf_server() of
true ->
{ok, Config} = application:get_env(arweave, config),
ServerWorkers = lists:map(
fun(Peer) ->
Name = list_to_atom("ar_nonce_limiter_server_worker_"
++ ar_util:peer_to_str(Peer)),
?CHILD_WITH_ARGS(ar_nonce_limiter_server_worker,
worker, Name, [Name, Peer])
end,
Config#config.nonce_limiter_client_peers
),
Client = ?CHILD_SUP(ar_nonce_limiter_client, worker),
Server = ?CHILD(ar_nonce_limiter_server, worker),
NonceLimiter = ?CHILD(ar_nonce_limiter, worker),

Workers = [NonceLimiter, Server, Client | ServerWorkers],
{ok, {{one_for_one, 5, 10}, Workers}}
end.
[NonceLimiter, Server, Client | ServerWorkers];
false ->
[NonceLimiter, Client]
end,
{ok, {{one_for_one, 5, 10}, Workers}}.
3 changes: 2 additions & 1 deletion apps/arweave/test/ar_test_node.erl
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,8 @@ wait_until_syncs_genesis_data(Node) ->

wait_until_syncs_genesis_data() ->
{ok, Config} = application:get_env(arweave, config),
WeaveSize = (ar_node:get_current_block())#block.weave_size,
B = ar_node:get_current_block(),
WeaveSize = B#block.weave_size,
[wait_until_syncs_data(N * Size, (N + 1) * Size, WeaveSize, any)
|| {Size, N, _Packing} <- Config#config.storage_modules],
%% Once the data is stored in the disk pool, make the storage modules
Expand Down

0 comments on commit 645160c

Please sign in to comment.