Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Berman committed Mar 28, 2024
1 parent d5a7989 commit deb70d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/arweave/src/ar_data_sync.erl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ add_chunk(DataRoot, DataPath, Chunk, Offset, TXSize) ->
%% @doc Return true if we expect the chunk with the given data root index value and
%% relative end offset to end up in one of the configured storage modules.
is_estimated_long_term_chunk(DataRootOffsetReply, EndOffset) ->
IsTipCovered = is_tip_covered(),
WeaveSize = ar_node:get_current_weave_size(),
IsTipCovered = is_offset_vicinity_covered(WeaveSize),
case DataRootOffsetReply of
not_found ->
%% A chunk from a pending transaction.
Expand All @@ -233,16 +234,15 @@ is_estimated_long_term_chunk(DataRootOffsetReply, EndOffset) ->
%% A relatively recent offset - do not expect this chunk to be
%% persisted unless we have some storage modules configured for
%% the space ahead (the data may be rearranged during after a reorg).
IsTipCovered andalso ar_storage_module:has_any(AbsoluteEndOffset);
is_offset_vicinity_covered(AbsoluteEndOffset);
false ->
ar_storage_module:has_any(AbsoluteEndOffset)
end
end.

is_tip_covered() ->
WeaveSize = ar_node:get_current_weave_size(),
is_offset_vicinity_covered(Offset) ->
Size = ar_node:get_recent_max_block_size(),
ar_storage_module:has_range(max(0, WeaveSize - Size * 2), WeaveSize + Size * 2).
ar_storage_module:has_range(max(0, Offset - Size * 2), Offset + Size * 2).

%% @doc Notify the server about the new pending data root (added to mempool).
%% The server may accept pending chunks and store them in the disk pool.
Expand Down

0 comments on commit deb70d9

Please sign in to comment.