Skip to content

Commit

Permalink
Sort on the P2P message handle instead of GraphQL
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmanzanera committed Sep 15, 2022
1 parent ab9ac91 commit a6a2eb7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/archethic/p2p/message.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,7 @@ defmodule Archethic.P2P.Message do

%{utxos: utxos, offset: offset, more?: more?} =
utxos
|> Enum.sort_by(& &1.timestamp, {:desc, DateTime})
|> Enum.with_index()
|> Enum.drop(offset)
|> Enum.reduce_while(%{utxos: [], offset: 0, more?: false}, fn {utxo, index}, acc ->
Expand Down Expand Up @@ -1512,6 +1513,7 @@ defmodule Archethic.P2P.Message do

%{inputs: inputs, offset: offset, more?: more?} =
inputs
|> Enum.sort_by(& &1.timestamp, {:desc, DateTime})
|> Enum.with_index()
|> Enum.drop(offset)
|> Enum.reduce_while(%{inputs: [], offset: 0, more?: false}, fn {input, index}, acc ->
Expand Down
1 change: 0 additions & 1 deletion lib/archethic_web/graphql_schema/resolver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ defmodule ArchethicWeb.GraphQLSchema.Resolver do
address
|> Archethic.get_transaction_inputs(paging_offset)
|> Enum.map(&TransactionInput.to_map/1)
|> Enum.sort_by(& &1.timestamp, {:desc, DateTime})

case limit do
0 ->
Expand Down

0 comments on commit a6a2eb7

Please sign in to comment.