diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index 7b50bc1a8..b44c9494b 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -413,7 +413,7 @@ func (c *ChainService) calculateNewBlockVotes(block *types.Block, aState *types. } } - // Write updated block vote cache back to DB + // Write updated block vote cache back to DB. if err = c.beaconDB.WriteBlockVoteCache(blockVoteCache); err != nil { return err } diff --git a/beacon-chain/types/active_state.go b/beacon-chain/types/active_state.go index 072dafb49..15cbffc1d 100644 --- a/beacon-chain/types/active_state.go +++ b/beacon-chain/types/active_state.go @@ -63,8 +63,8 @@ func (a *ActiveState) Hash() ([32]byte, error) { // CopyState returns a deep copy of the current active state. func (a *ActiveState) CopyState() *ActiveState { - pendingAttestations := make([]*pb.AggregatedAttestation, len(a.PendingAttestations())) - for index, pendingAttestation := range a.PendingAttestations() { + pendingAttestations := make([]*pb.AggregatedAttestation, len(a.data.PendingAttestations)) + for index, pendingAttestation := range a.data.PendingAttestations { pendingAttestations[index] = &pb.AggregatedAttestation{ Slot: pendingAttestation.GetSlot(), Shard: pendingAttestation.GetShard(), @@ -77,13 +77,13 @@ func (a *ActiveState) CopyState() *ActiveState { } } - recentBlockHashes := make([][]byte, len(a.RecentBlockHashes())) - for r, hash := range a.RecentBlockHashes() { - recentBlockHashes[r] = hash[:] + recentBlockHashes := make([][]byte, len(a.data.RecentBlockHashes)) + for r, hash := range a.data.RecentBlockHashes { + recentBlockHashes[r] = hash } - pendingSpecials := make([]*pb.SpecialRecord, len(a.PendingSpecials())) - for index, pendingSpecial := range a.PendingSpecials() { + pendingSpecials := make([]*pb.SpecialRecord, len(a.data.PendingSpecials)) + for index, pendingSpecial := range a.data.PendingSpecials { pendingSpecials[index] = &pb.SpecialRecord{ Kind: pendingSpecial.GetKind(), Data: pendingSpecial.GetData(), @@ -91,7 +91,7 @@ func (a *ActiveState) CopyState() *ActiveState { } randaoMix := a.RandaoMix() - newC := ActiveState{ + newA := ActiveState{ data: &pb.ActiveState{ PendingAttestations: pendingAttestations, RecentBlockHashes: recentBlockHashes, @@ -100,7 +100,7 @@ func (a *ActiveState) CopyState() *ActiveState { }, } - return &newC + return &newA } // PendingAttestations returns attestations that have not yet been processed.