Skip to content

Commit

Permalink
Fix timestamp for get_last_chain_address
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Dec 11, 2022
1 parent 2520cea commit e3dfd26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/archethic/db/embedded_impl/chain_index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,14 @@ defmodule Archethic.DB.EmbeddedImpl.ChainIndex do
# We get the genesis address of this given transaction address
case get_tx_entry(address, db_path) do
{:ok, %{genesis_address: genesis_address}} ->
search_last_address_until(genesis_address, unix_time, db_path) || {address, datetime}
search_last_address_until(genesis_address, unix_time, db_path) ||
{address, DateTime.from_unix!(0, :millisecond)}

{:error, :not_exists} ->
# We try to search with given address as genesis address
# Then `address` acts the genesis address
search_last_address_until(address, unix_time, db_path) || {address, datetime}
search_last_address_until(address, unix_time, db_path) ||
{address, DateTime.from_unix!(0, :millisecond)}
end
end

Expand Down

0 comments on commit e3dfd26

Please sign in to comment.