Skip to content

Commit

Permalink
fix(rpc): handle nil value in preapply result
Browse files Browse the repository at this point in the history
  • Loading branch information
Awea committed Oct 21, 2024
1 parent f84e791 commit 9b4e8a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rpc.ex
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ defmodule Tezex.Rpc do

defp do_preapply_operation(%Rpc{} = rpc, payload) do
case post(rpc, "/blocks/head/helpers/preapply/operations", payload) do
{:ok, [%{"contents" => preapplied_operations}]} ->
{:ok, [%{"contents" => preapplied_operations}]} when is_list(preapplied_operations) ->
applied? =
Enum.all?(
preapplied_operations,
Expand Down Expand Up @@ -275,6 +275,9 @@ defmodule Tezex.Rpc do
{:error, errors}
end

{:ok, [%{"contents" => nil}]} ->
{:error, :nil_preapply}

{:ok, result} ->
{:error, result}

Expand Down

0 comments on commit 9b4e8a3

Please sign in to comment.