Skip to content

Commit

Permalink
Make summary transaction address more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel committed Jun 2, 2022
1 parent 46ae7b6 commit 323083e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 1 addition & 7 deletions lib/archethic/beacon_chain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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, <<DateTime.to_unix(date)::32>>])
)

Crypto.derive_address(pub)
Crypto.derive_beacon_chain_address(subset, date, true)
end

@doc """
Expand Down
4 changes: 1 addition & 3 deletions lib/archethic/election.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 323083e

Please sign in to comment.