Skip to content

Commit

Permalink
fix(fee): use byte_size instead of String.length
Browse files Browse the repository at this point in the history
  • Loading branch information
Awea committed May 21, 2024
1 parent 42fe2ca commit c2c817e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/fee.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Tezex.Fee do
minimal_nanotez_per_gas_unit =
Keyword.get(opts, :minimal_nanotez_per_gas_unit, @minimal_nanotez_per_gas_unit)

size = String.length(ForgeOperation.operation(content)) + extra_size
size = byte_size(ForgeOperation.operation(content)) + extra_size

fee =
@minimal_fees + @minimal_mutez_per_byte * size +
Expand Down
4 changes: 2 additions & 2 deletions test/rpc_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ defmodule Tezex.RpcTest do
"amount" => "1000000",
"counter" => "26949360",
"destination" => "KT1MFWsAXGUZ4gFkQnjByWjrrVtuQi4Tya8G",
"fee" => "649",
"fee" => "651",
"gas_limit" => "2419",
"kind" => "transaction",
"source" => "tz1ZW1ZSN4ruXYc3nCon8EaTXp1t3tKWb9Ew",
Expand Down Expand Up @@ -326,7 +326,7 @@ defmodule Tezex.RpcTest do
"contents" => [
%{
"amount" => "100",
"fee" => "284",
"fee" => "285",
"gas_limit" => "269",
"storage_limit" => "0"
}
Expand Down

0 comments on commit c2c817e

Please sign in to comment.