Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix paging address with selected fields #601

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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