예제 #1
0
 public BeaconState(ulong genesisTime, ulong eth1DepositIndex, Eth1Data eth1Data, BeaconBlockHeader latestBlockHeader,
                    Slot slotsPerHistoricalRoot, Epoch epochsPerHistoricalVector, Epoch epochsPerSlashingsVector, int justificationBitsLength)
 {
     GenesisTime                = genesisTime;
     Eth1DepositIndex           = eth1DepositIndex;
     _eth1DataVotes             = new List <Eth1Data>();
     Eth1Data                   = eth1Data;
     LatestBlockHeader          = latestBlockHeader;
     _validators                = new List <Validator>();
     _balances                  = new List <Gwei>();
     _blockRoots                = Enumerable.Repeat(Hash32.Zero, (int)(ulong)slotsPerHistoricalRoot).ToArray();
     _stateRoots                = Enumerable.Repeat(Hash32.Zero, (int)(ulong)slotsPerHistoricalRoot).ToArray();
     _historicalRoots           = new List <Hash32>();
     _randaoMixes               = Enumerable.Repeat(Hash32.Zero, (int)(ulong)epochsPerHistoricalVector).ToArray();
     _slashings                 = Enumerable.Repeat(Gwei.Zero, (int)(ulong)epochsPerSlashingsVector).ToArray();
     _previousEpochAttestations = new List <PendingAttestation>();
     _currentEpochAttestations  = new List <PendingAttestation>();
     JustificationBits          = new BitArray(justificationBitsLength);
     Fork = new Fork(new ForkVersion(), new ForkVersion(), Epoch.Zero);
     CurrentJustifiedCheckpoint  = new Checkpoint(new Epoch(0), Hash32.Zero);
     PreviousJustifiedCheckpoint = new Checkpoint(new Epoch(0), Hash32.Zero);
     FinalizedCheckpoint         = new Checkpoint(new Epoch(0), Hash32.Zero);
     //_previousCrosslinks = Enumerable.Repeat(new Crosslink(Shard.Zero), (int)(ulong)shardCount).ToArray();
     //_currentCrosslinks = Enumerable.Repeat(new Crosslink(Shard.Zero), (int)(ulong)shardCount).ToArray();
     //_currentCrosslinks = Enumerable.Range(0, (int)(ulong)shardCount).Select(x => new Crosslink(new Shard((ulong)x))).ToArray();
 }
예제 #2
0
 public void SetLatestBlockHeader(BeaconBlockHeader blockHeader) => LatestBlockHeader = blockHeader;