Use same code for decode Explorer.Chain.Hash and Explorer.Chain.Code

pull/180/head
Luke Imhoff 7 years ago
parent a96f05d065
commit 455adaddca
  1. 4
      apps/explorer/lib/explorer/chain/hash.ex

@ -196,8 +196,8 @@ defmodule Explorer.Chain.Hash do
hexadecimal_digit_count = byte_count_to_hexadecimal_digit_count(byte_count)
with ^hexadecimal_digit_count <- String.length(hexadecimal_digits),
{integer, ""} <- Integer.parse(hexadecimal_digits, 16) do
cast_integer(integer, byte_count)
{:ok, bytes} <- Base.decode16(hexadecimal_digits, case: :mixed) do
{:ok, %__MODULE__{byte_count: byte_count, bytes: bytes}}
else
_ -> :error
end

Loading…
Cancel
Save