mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
Fixed Validator Shuffling (#749)
* fixed parent hashes copy bug * use data
This commit is contained in:
parent
0e28b667f3
commit
a0569ee7ad
@ -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 {
|
if err = c.beaconDB.WriteBlockVoteCache(blockVoteCache); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ func (a *ActiveState) Hash() ([32]byte, error) {
|
|||||||
|
|
||||||
// CopyState returns a deep copy of the current active state.
|
// CopyState returns a deep copy of the current active state.
|
||||||
func (a *ActiveState) CopyState() *ActiveState {
|
func (a *ActiveState) CopyState() *ActiveState {
|
||||||
pendingAttestations := make([]*pb.AggregatedAttestation, len(a.PendingAttestations()))
|
pendingAttestations := make([]*pb.AggregatedAttestation, len(a.data.PendingAttestations))
|
||||||
for index, pendingAttestation := range a.PendingAttestations() {
|
for index, pendingAttestation := range a.data.PendingAttestations {
|
||||||
pendingAttestations[index] = &pb.AggregatedAttestation{
|
pendingAttestations[index] = &pb.AggregatedAttestation{
|
||||||
Slot: pendingAttestation.GetSlot(),
|
Slot: pendingAttestation.GetSlot(),
|
||||||
Shard: pendingAttestation.GetShard(),
|
Shard: pendingAttestation.GetShard(),
|
||||||
@ -77,13 +77,13 @@ func (a *ActiveState) CopyState() *ActiveState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recentBlockHashes := make([][]byte, len(a.RecentBlockHashes()))
|
recentBlockHashes := make([][]byte, len(a.data.RecentBlockHashes))
|
||||||
for r, hash := range a.RecentBlockHashes() {
|
for r, hash := range a.data.RecentBlockHashes {
|
||||||
recentBlockHashes[r] = hash[:]
|
recentBlockHashes[r] = hash
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingSpecials := make([]*pb.SpecialRecord, len(a.PendingSpecials()))
|
pendingSpecials := make([]*pb.SpecialRecord, len(a.data.PendingSpecials))
|
||||||
for index, pendingSpecial := range a.PendingSpecials() {
|
for index, pendingSpecial := range a.data.PendingSpecials {
|
||||||
pendingSpecials[index] = &pb.SpecialRecord{
|
pendingSpecials[index] = &pb.SpecialRecord{
|
||||||
Kind: pendingSpecial.GetKind(),
|
Kind: pendingSpecial.GetKind(),
|
||||||
Data: pendingSpecial.GetData(),
|
Data: pendingSpecial.GetData(),
|
||||||
@ -91,7 +91,7 @@ func (a *ActiveState) CopyState() *ActiveState {
|
|||||||
}
|
}
|
||||||
randaoMix := a.RandaoMix()
|
randaoMix := a.RandaoMix()
|
||||||
|
|
||||||
newC := ActiveState{
|
newA := ActiveState{
|
||||||
data: &pb.ActiveState{
|
data: &pb.ActiveState{
|
||||||
PendingAttestations: pendingAttestations,
|
PendingAttestations: pendingAttestations,
|
||||||
RecentBlockHashes: recentBlockHashes,
|
RecentBlockHashes: recentBlockHashes,
|
||||||
@ -100,7 +100,7 @@ func (a *ActiveState) CopyState() *ActiveState {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return &newC
|
return &newA
|
||||||
}
|
}
|
||||||
|
|
||||||
// PendingAttestations returns attestations that have not yet been processed.
|
// PendingAttestations returns attestations that have not yet been processed.
|
||||||
|
Loading…
Reference in New Issue
Block a user