Exemplo n.º 1
0
        public void ProcessSlot(BeaconState state)
        {
            _logger.LogInformation(Event.ProcessSlot, "Process current slot {Slot} for state {BeaconState}", state.Slot, state);
            // Cache state root
            var previousStateRoot = state.HashTreeRoot(_miscellaneousParameterOptions.CurrentValue, _timeParameterOptions.CurrentValue,
                                                       _stateListLengthOptions.CurrentValue, _maxOperationsPerBlockOptions.CurrentValue);
            var previousRootIndex = state.Slot % _timeParameterOptions.CurrentValue.SlotsPerHistoricalRoot;

            state.SetStateRoot(previousRootIndex, previousStateRoot);
            // Cache latest block header state root
            if (state.LatestBlockHeader.StateRoot == Hash32.Zero)
            {
                state.LatestBlockHeader.SetStateRoot(previousStateRoot);
            }
            // Cache block root
            var previousBlockRoot = state.LatestBlockHeader.SigningRoot();

            state.SetBlockRoot(previousRootIndex, previousBlockRoot);
        }