mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
Save Boundary States (#6542)
This commit is contained in:
parent
2c9474ab7f
commit
cc8b3e349d
@ -221,11 +221,16 @@ func (s *Service) onBlockBatch(ctx context.Context, blks []*ethpb.SignedBeaconBl
|
|||||||
Messages: [][32]byte{},
|
Messages: [][32]byte{},
|
||||||
}
|
}
|
||||||
set := new(bls.SignatureSet)
|
set := new(bls.SignatureSet)
|
||||||
|
boundaries := make(map[[32]byte]*stateTrie.BeaconState)
|
||||||
for i, b := range blks {
|
for i, b := range blks {
|
||||||
set, preState, err = state.ExecuteStateTransitionNoVerifyAnySig(ctx, preState, b)
|
set, preState, err = state.ExecuteStateTransitionNoVerifyAnySig(ctx, preState, b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
// Save potential boundary states.
|
||||||
|
if helpers.IsEpochStart(preState.Slot()) {
|
||||||
|
boundaries[blockRoots[i]] = preState.Copy()
|
||||||
|
}
|
||||||
jCheckpoints[i] = preState.CurrentJustifiedCheckpoint()
|
jCheckpoints[i] = preState.CurrentJustifiedCheckpoint()
|
||||||
fCheckpoints[i] = preState.FinalizedCheckpoint()
|
fCheckpoints[i] = preState.FinalizedCheckpoint()
|
||||||
sigSet.Join(set)
|
sigSet.Join(set)
|
||||||
@ -237,6 +242,11 @@ func (s *Service) onBlockBatch(ctx context.Context, blks []*ethpb.SignedBeaconBl
|
|||||||
if !verify {
|
if !verify {
|
||||||
return nil, nil, nil, errors.New("batch block signature verification failed")
|
return nil, nil, nil, errors.New("batch block signature verification failed")
|
||||||
}
|
}
|
||||||
|
for r, st := range boundaries {
|
||||||
|
if err := s.stateGen.SaveState(ctx, r, st); err != nil {
|
||||||
|
return nil, nil, nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
return preState, fCheckpoints, jCheckpoints, nil
|
return preState, fCheckpoints, jCheckpoints, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user