Skip to content

Commit

Permalink
Fix chunk2 handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shizzard committed Feb 4, 2025
1 parent 5de5e45 commit 2d4119f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/arweave/src/ar_mining_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ handle_task({computed_h1, Candidate, _ExtraArgs}, State) ->
%% Decrement 1 for chunk1:
%% do_not_cache indicates chunk2 was not and will not be read or cached
{noreply, State3};
{{chunk2, Chunk2}, State3} ->
{{Chunk2, #{chunk2 := true}}, State3} ->
%% Chunk2 has already been read, so we can compute H2 now.
ar_mining_hash:compute_h2(
self(), Candidate#mining_candidate{ chunk2 = Chunk2 }),
Expand Down Expand Up @@ -794,8 +794,8 @@ cycle_sub_chunk_cache(#mining_candidate{ cache_ref = CacheRef } = Candidate, Chu
{error, chunk_not_found} ->
{ok, ChunkCache2} = ar_chunk_cache:add_chunk(SessionKey, {CacheRef, Nonce}, {Chunk, ChunkMeta}, State#state.chunk_cache),
{cached, State#state{ chunk_cache = ChunkCache2 }};
{ok, {Data, _}, ChunkCache1} ->
{Data, State#state{ chunk_cache = ChunkCache1 }}
{ok, RetVal, ChunkCache1} ->
{RetVal, State#state{ chunk_cache = ChunkCache1 }}
end.

%% @doc Remove SubChunkCount sub-chunks from the cache starting at
Expand Down

0 comments on commit 2d4119f

Please sign in to comment.