From 323083ee9db7d1ff03b699a65c1bc82a81081bb5 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 2 Jun 2022 13:28:11 +0200 Subject: [PATCH] Make summary transaction address more consistent --- lib/archethic/beacon_chain.ex | 8 +------- lib/archethic/election.ex | 4 +--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/archethic/beacon_chain.ex b/lib/archethic/beacon_chain.ex index 65337e7c8..0e08a76c2 100644 --- a/lib/archethic/beacon_chain.ex +++ b/lib/archethic/beacon_chain.ex @@ -91,13 +91,7 @@ defmodule Archethic.BeaconChain do """ @spec summary_transaction_address(binary(), DateTime.t()) :: binary() def summary_transaction_address(subset, date = %DateTime{}) when is_binary(subset) do - {pub, _} = - Crypto.derive_keypair( - Crypto.storage_nonce(), - Crypto.hash([subset, <>]) - ) - - Crypto.derive_address(pub) + Crypto.derive_beacon_chain_address(subset, date, true) end @doc """ diff --git a/lib/archethic/election.ex b/lib/archethic/election.ex index 41c8a5902..6ce7f3352 100755 --- a/lib/archethic/election.ex +++ b/lib/archethic/election.ex @@ -4,8 +4,6 @@ defmodule Archethic.Election do and constraints to ensure a fair distributed processing and data storage among its network. """ - alias Archethic.BeaconChain - alias Archethic.Crypto alias __MODULE__.Constraints @@ -620,7 +618,7 @@ defmodule Archethic.Election do ) when is_binary(subset) and is_list(nodes) do subset - |> BeaconChain.summary_transaction_address(date) + |> Crypto.derive_beacon_chain_address(date, true) |> storage_nodes(nodes, storage_constraints) end