Skip to content

Commit

Permalink
Add a price multiplier to compensate for Arweave base protocol price …
Browse files Browse the repository at this point in the history
…adjustment
  • Loading branch information
djwhitt committed Feb 21, 2024
1 parent 6dc7b68 commit e867dd8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/arweave/src/ar_http_iface_middleware.erl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

-define(HANDLER_TIMEOUT, 55000).

-define(PRICE_ENDPOINT_MULT, 1.1).

-define(MAX_SERIALIZED_RECENT_HASH_LIST_DIFF, 2400). % 50 * 48.
-define(MAX_SERIALIZED_MISSING_TX_INDICES, 125). % Every byte encodes 8 positions.

Expand Down Expand Up @@ -637,7 +639,7 @@ handle(<<"GET">>, [<<"price">>, SizeInBytesBinary], Req, _Pid) ->
{400, #{}, jiffy:encode(#{ error => size_must_be_an_integer }), Req};
Size ->
{Fee, _Denomination} = estimate_tx_fee(Size, <<>>),
{200, #{}, integer_to_binary(Fee), Req}
{200, #{}, integer_to_binary(erlang:ceil(Fee * ?PRICE_ENDPOINT_MULT)), Req}
end
end;

Expand Down Expand Up @@ -696,7 +698,7 @@ handle(<<"GET">>, [<<"price">>, SizeInBytesBinary, EncodedAddr], Req, _Pid) ->
Req};
Size ->
{Fee, _Denomination} = estimate_tx_fee(Size, Addr),
{200, #{}, integer_to_binary(Fee), Req}
{200, #{}, integer_to_binary(erlang:ceil(Fee * ?PRICE_ENDPOINT_MULT)), Req}
end
end
end;
Expand Down

0 comments on commit e867dd8

Please sign in to comment.