Exemple #1
0
        private byte[] GetCheckableRound(bool isContainPreviousInValue = true)
        {
            var minersInformation = new Dictionary <string, MinerInRound>();

            foreach (var minerInRound in RealTimeMinersInformation.Clone())
            {
                var checkableMinerInRound = minerInRound.Value.Clone();
                checkableMinerInRound.EncryptedPieces.Clear();
                checkableMinerInRound.DecryptedPieces.Clear();
                checkableMinerInRound.ActualMiningTimes.Clear();
                if (!isContainPreviousInValue)
                {
                    checkableMinerInRound.PreviousInValue = Hash.Empty;
                }

                minersInformation.Add(minerInRound.Key, checkableMinerInRound);
            }

            var checkableRound = new Round
            {
                RoundNumber = RoundNumber,
                TermNumber  = TermNumber,
                RealTimeMinersInformation = { minersInformation },
                BlockchainAge             = BlockchainAge
            };

            return(checkableRound.ToByteArray());
        }
Exemple #2
0
        public Round GetSimpleRound()
        {
            var minersInformation = new Dictionary <string, MinerInRound>();

            foreach (var minerInRound in RealTimeMinersInformation.Clone())
            {
                var checkableMinerInRound = minerInRound.Value.Clone();
                checkableMinerInRound.EncryptedPieces.Clear();
                checkableMinerInRound.DecryptedPieces.Clear();
                checkableMinerInRound.ActualMiningTimes.Clear();
                minersInformation.Add(minerInRound.Key, checkableMinerInRound);
            }

            return(new Round
            {
                RoundNumber = RoundNumber,
                RealTimeMinersInformation = { minersInformation },
            });
        }