public async Task<TransactionSet> GetTransactionsAsync(int minRecentTransactions, int minRecentBlocks)
{
var client = new WalletService.WalletServiceClient(_channel);
var request = new GetTransactionsRequest
{
// TODO: include these. With these uncommented, all transactions are loaded.
//StartingBlockHeight = -minRecentBlocks,
//MinimumRecentTransactions = minRecentTransactions
};
var responseStream = client.GetTransactions(request, cancellationToken: _tokenSource.Token).ResponseStream;
var minedTransactions = new List<Block>();
Dictionary<Blake256Hash, WalletTransaction> unminedTransactions = null;
while (await responseStream.MoveNext())
{
var msg = responseStream.Current;
if (msg.MinedTransactions != null)
minedTransactions.Add(MarshalBlock(msg.MinedTransactions));
else
unminedTransactions = msg.UnminedTransactions.Select(MarshalWalletTransaction).ToDictionary(tx => tx.Hash);
}
return new TransactionSet(minedTransactions, unminedTransactions ?? new Dictionary<Blake256Hash, WalletTransaction>());
}