diff --git a/lib/archethic/metrics/poller.ex b/lib/archethic/metrics/poller.ex index 9ddbe1068..ee47f792a 100644 --- a/lib/archethic/metrics/poller.ex +++ b/lib/archethic/metrics/poller.ex @@ -70,7 +70,9 @@ defmodule Archethic.Metrics.Poller do http_port: port, first_public_key: first_public_key } -> - {first_public_key, Collector.fetch_metrics(ip, port)} + if first_public_key == Archethic.Crypto.first_node_public_key(), + do: {first_public_key, Collector.fetch_metrics({127, 0, 0, 1}, port)}, + else: {first_public_key, Collector.fetch_metrics(ip, port)} end, on_timeout: :kill_task ) diff --git a/lib/archethic/p2p/message.ex b/lib/archethic/p2p/message.ex index 8d402fdd8..a2d08c4de 100644 --- a/lib/archethic/p2p/message.ex +++ b/lib/archethic/p2p/message.ex @@ -539,14 +539,14 @@ defmodule Archethic.P2P.Message do token_balances_binary = token_balances |> Enum.reduce([], fn {{token_address, token_id}, amount}, acc -> - [<> | acc] + [<> | acc] end) |> Enum.reverse() |> :erlang.list_to_binary() encoded_token_balances_length = map_size(token_balances) |> VarInt.from_value() - <<248::8, uco_balance::float, encoded_token_balances_length::binary, + <<248::8, uco_balance::64, encoded_token_balances_length::binary, token_balances_binary::binary>> end @@ -1084,7 +1084,7 @@ defmodule Archethic.P2P.Message do }, rest} end - def decode(<<248::8, uco_balance::float, rest::bitstring>>) do + def decode(<<248::8, uco_balance::64, rest::bitstring>>) do {nb_token_balances, rest} = rest |> VarInt.get_value() {token_balances, rest} = deserialize_token_balances(rest, nb_token_balances, %{}) @@ -1200,7 +1200,7 @@ defmodule Archethic.P2P.Message do end defp deserialize_token_balances(rest, nb_token_balances, acc) do - {token_address, <>} = Utils.deserialize_address(rest) + {token_address, <>} = Utils.deserialize_address(rest) {token_id, rest} = VarInt.get_value(rest) deserialize_token_balances( diff --git a/lib/archethic_web/live/chains/oracle_live.ex b/lib/archethic_web/live/chains/oracle_live.ex index 41cdaa054..4052823e9 100644 --- a/lib/archethic_web/live/chains/oracle_live.ex +++ b/lib/archethic_web/live/chains/oracle_live.ex @@ -180,7 +180,7 @@ defmodule ArchethicWeb.OracleChainLive do } -> %{address: address, type: type, timestamp: timestamp} end) - |> Enum.to_list() + |> Enum.reverse() end defp list_transactions_by_date(nil), do: []