Skip to content

Commit

Permalink
Fix fee calculation crashing on log10(0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Oct 18, 2022
1 parent 6eff994 commit dbced77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/archethic/mining/fee.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ defmodule Archethic.Mining.Fee do
) do
with {:ok, json} <- Jason.decode(content),
"non-fungible" <- Map.get(json, "type", "fungible"),
utxos when is_list(utxos) <- Map.get(json, "collection") do
nb_utxos = length(utxos)
utxos when is_list(utxos) <- Map.get(json, "collection"),
nb_utxos when nb_utxos > 0 <- length(utxos) do
base_fee = minimum_fee(uco_price_in_usd)
(:math.log10(nb_utxos) + 1) * nb_utxos * base_fee
else
Expand Down

0 comments on commit dbced77

Please sign in to comment.