Exemplo n.º 1
0
        private Dictionary <MultiHash, Delta> BuildChainedDeltas(int chainSize)
        {
            var chainedDeltas = Enumerable.Range(0, chainSize + 1).ToDictionary(
                i => _hashProvider.ComputeUtf8MultiHash(i.ToString()),
                i =>
            {
                var previousHash = _hashProvider.ComputeUtf8MultiHash((i - 1).ToString());
                var delta        = DeltaHelper.GetDelta(_hashProvider, previousHash);
                return(delta);
            });

            _output.WriteLine("chain is:");
            _output.WriteLine(string.Join(Environment.NewLine,
                                          chainedDeltas.Select((c, i) =>
                                                               $"{i}: current {c.Key} | previous {_hashProvider.Cast(c.Value.PreviousDeltaDfsHash.ToByteArray())}")));
            return(chainedDeltas);
        }