2022-05-09 13:02:34 +00:00
|
|
|
package state_native
|
2022-01-13 11:23:53 +00:00
|
|
|
|
|
|
|
import (
|
2023-03-17 18:52:56 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/beacon-chain/state/state-native/types"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/runtime/version"
|
2022-01-13 11:23:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// SetCurrentSyncCommittee for the beacon state.
|
|
|
|
func (b *BeaconState) SetCurrentSyncCommittee(val *ethpb.SyncCommittee) error {
|
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
|
|
|
|
2022-05-09 13:02:34 +00:00
|
|
|
if b.version == version.Phase0 {
|
|
|
|
return errNotSupported("SetCurrentSyncCommittee", b.version)
|
|
|
|
}
|
|
|
|
|
2022-02-01 00:32:39 +00:00
|
|
|
b.currentSyncCommittee = val
|
2023-01-26 14:40:12 +00:00
|
|
|
b.markFieldAsDirty(types.CurrentSyncCommittee)
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNextSyncCommittee for the beacon state.
|
|
|
|
func (b *BeaconState) SetNextSyncCommittee(val *ethpb.SyncCommittee) error {
|
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
|
|
|
|
2022-05-09 13:02:34 +00:00
|
|
|
if b.version == version.Phase0 {
|
|
|
|
return errNotSupported("SetNextSyncCommittee", b.version)
|
|
|
|
}
|
|
|
|
|
2022-02-01 00:32:39 +00:00
|
|
|
b.nextSyncCommittee = val
|
2023-01-26 14:40:12 +00:00
|
|
|
b.markFieldAsDirty(types.NextSyncCommittee)
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil
|
|
|
|
}
|