Skip to content

Commit

Permalink
Get staged txs from StagePolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
moreal committed Sep 25, 2024
1 parent 2b3dfb4 commit f075b75
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions NineChronicles.Headless/GraphTypes/NodeStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ public NodeStatusType(StandaloneContext context, IBlockChainRepository blockChai

if (!fieldContext.HasArgument("address"))
{
return context.BlockChain.GetStagedTransactionIds();
return context.BlockChain.StagePolicy.Iterate(context.BlockChain).Select(tx => tx.Id)
.ToImmutableHashSet();
}
else
{
Address address = fieldContext.GetArgument<Address>("address");
IImmutableSet<TxId> stagedTransactionIds = context.BlockChain.GetStagedTransactionIds();

return stagedTransactionIds.Where(txId =>
context.BlockChain.GetTransaction(txId).Signer.Equals(address));
return context.BlockChain.StagePolicy.Iterate(context.BlockChain)
.Where(tx => tx.Signer.Equals(address)).Select(tx => tx.Id).ToImmutableHashSet();
}
}
);
Expand All @@ -121,7 +121,7 @@ public NodeStatusType(StandaloneContext context, IBlockChainRepository blockChai
throw new InvalidOperationException($"{nameof(context.BlockChain)} is null.");
}

return context.BlockChain.GetStagedTransactionIds().Count;
return context.BlockChain.StagePolicy.Iterate(context.BlockChain).ToImmutableHashSet().Count;
}
);
Field<NonNullGraphType<BlockHeaderType>>(
Expand Down

0 comments on commit f075b75

Please sign in to comment.