diff --git a/apps/arweave/src/ar_block_pre_validator.erl b/apps/arweave/src/ar_block_pre_validator.erl index 455bbc5d1..67bc37227 100644 --- a/apps/arweave/src/ar_block_pre_validator.erl +++ b/apps/arweave/src/ar_block_pre_validator.erl @@ -458,6 +458,13 @@ get_last_step_prev_output(B) -> end. validate_poa_against_cached_poa(B, CacheB) -> + case CacheB#block.poa_cache of + {_, _} -> + ok; + _ -> + ID = binary_to_list(ar_util:encode(crypto:strong_rand_bytes(2))), + file:write_file("/opt/arweave/bad-block-" ++ ID, term_to_binary(B)) + end, #block{ poa_cache = {ArgCache, ChunkID}, poa2_cache = Cache2 } = CacheB, Args = erlang:append_element(erlang:insert_element(5, ArgCache, B#block.poa), ChunkID), case ar_poa:validate(Args) of diff --git a/apps/arweave/src/ar_data_sync_worker_master.erl b/apps/arweave/src/ar_data_sync_worker_master.erl index 30d003c3b..387be3c99 100644 --- a/apps/arweave/src/ar_data_sync_worker_master.erl +++ b/apps/arweave/src/ar_data_sync_worker_master.erl @@ -240,7 +240,7 @@ process_peer_queue(PeerTasks, State) -> %% @doc the maximum number of tasks we can have in process - including stasks queued here as well %% as those scheduled on ar_data_sync_workers. max_tasks(WorkerCount) -> - WorkerCount * 50. + WorkerCount * 5. %% @doc The maximum number of tasks we can have queued for a given peer. max_peer_queue(_Peformance, 0, _WorkerCount) -> diff --git a/apps/arweave/src/ar_http_iface_middleware.erl b/apps/arweave/src/ar_http_iface_middleware.erl index f5e740e30..13db49b0e 100644 --- a/apps/arweave/src/ar_http_iface_middleware.erl +++ b/apps/arweave/src/ar_http_iface_middleware.erl @@ -2432,6 +2432,7 @@ post_block(check_transactions_are_present, {BShadow, Peer}, Req, ReceiveTimestam post_block(enqueue_block, {BShadow, Peer}, Req, ReceiveTimestamp) end; post_block(enqueue_block, {B, Peer}, Req, ReceiveTimestamp) -> + try B2 = case B#block.height >= ar_fork:height_2_6() of true -> @@ -2459,6 +2460,12 @@ post_block(enqueue_block, {B, Peer}, Req, ReceiveTimestamp) -> byte_size(term_to_binary(B))); _ -> ok + end + catch + error:Reason:Stacktrace -> + ID = binary_to_list(ar_util:encode(crypto:strong_rand_bytes(16))), + file:write_file("/opt/arweave/stacktrace" ++ ID, term_to_binary(Stacktrace)), + ?LOG_ERROR("CAUGHT ~p ~p", [Reason, Stacktrace]) end, {200, #{}, <<"OK">>, Req}.