Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
Change empty option name to excludeEmptyTxs
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeguiee committed Aug 16, 2019
1 parent 31c0512 commit 2909bf2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Libplanet.Explorer/GraphTypes/BlocksQuery.cs
Expand Up @@ -33,17 +33,17 @@ public BlocksQuery(BlockChain<T> chain)
new QueryArgument<IntGraphType> { Name = "limit" },
new QueryArgument<BooleanGraphType>
{
Name = "empty",
DefaultValue = true,
Name = "excludeEmptyTxs",
DefaultValue = false,
}
),
resolve: context =>
{
bool desc = context.GetArgument<bool>("desc");
long offset = context.GetArgument<long>("offset");
int? limit = context.GetArgument<int?>("limit", null);
bool empty = context.GetArgument<bool>("empty");
return ListBlocks(desc, offset, limit, empty);
bool excludeEmptyTxs = context.GetArgument<bool>("excludeEmptyTxs");
return ListBlocks(desc, offset, limit, excludeEmptyTxs);
}
);

Expand Down Expand Up @@ -78,7 +78,11 @@ public BlocksQuery(BlockChain<T> chain)
Name = "BlockQuery";
}

private IEnumerable<Block<T>> ListBlocks(bool desc, long offset, long? limit, bool empty)
private IEnumerable<Block<T>> ListBlocks(
bool desc,
long offset,
long? limit,
bool excludeEmptyTxs)
{
Block<T> tip = _chain.Tip;
long tipIndex = tip.Index;
Expand All @@ -97,7 +101,7 @@ private IEnumerable<Block<T>> ListBlocks(bool desc, long offset, long? limit, bo

while (limit is null || limit > 0)
{
if (empty || block.Transactions.Any())
if (!excludeEmptyTxs || block.Transactions.Any())
{
yield return block;
}
Expand Down

0 comments on commit 2909bf2

Please sign in to comment.