Skip to content

Commit

Permalink
Include paging address with selected fields in DB queries (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix authored Oct 4, 2022
1 parent 4a5eac8 commit f79e293
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/archethic/db/embedded_impl/chain_reader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ defmodule Archethic.DB.EmbeddedImpl.ChainReader do
end

defp do_process_get_chain(fd, address, fields) do
# Always return transaction address
fields = if Enum.empty?(fields), do: fields, else: Enum.uniq([:address | fields])

column_names = fields_to_column_names(fields)

# Read the transactions until the nb of transactions to fullfil the page (ie. 10 transactions)
Expand Down Expand Up @@ -174,6 +177,9 @@ defmodule Archethic.DB.EmbeddedImpl.ChainReader do
{list(Transaction.t()), boolean(), binary() | nil}
def scan_chain(genesis_address, limit_address, fields, paging_address, db_path) do
filepath = ChainWriter.chain_path(db_path, genesis_address)
# Always return transaction address
fields = if Enum.empty?(fields), do: fields, else: Enum.uniq([:address | fields])

column_names = fields_to_column_names(fields)

case File.open(filepath, [:binary, :read]) do
Expand Down

0 comments on commit f79e293

Please sign in to comment.