Exemple #1
0
        public async Task InsertSpentOutputsAsync(Guid transactionId, IEnumerable <Output> outputs)
        {
            var entities = outputs.Select(o => SpentOutputEntity.Create(o.Hash, o.OutputIndex, transactionId));

            await entities.GroupBy(o => o.PartitionKey)
            .ForEachAsyncSemaphore(8, group => _table.InsertOrReplaceAsync(group));
        }
Exemple #2
0
 public async Task <IEnumerable <Output> > GetSpentOutputsAsync(IEnumerable <Output> outputs)
 {
     return((await _table.GetDataAsync(outputs.Select(o =>
                                                      new Tuple <string, string>(SpentOutputEntity.GeneratePartitionKey(o.Hash),
                                                                                 SpentOutputEntity.GenerateRowKey(o.OutputIndex)))))
            .Select(p => new Output(p.Hash, p.OutputIndex)));
 }