2022-05-09 13:02:34 +00:00
|
|
|
package state_native
|
2022-01-13 11:23:53 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prysmaticlabs/go-bitfield"
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native/types"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
2022-01-13 11:23:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// SetJustificationBits for the beacon state.
|
|
|
|
func (b *BeaconState) SetJustificationBits(val bitfield.Bitvector4) error {
|
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
|
|
|
|
2022-01-27 08:42:32 +00:00
|
|
|
b.justificationBits = val
|
2023-01-26 14:40:12 +00:00
|
|
|
b.markFieldAsDirty(types.JustificationBits)
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPreviousJustifiedCheckpoint for the beacon state.
|
|
|
|
func (b *BeaconState) SetPreviousJustifiedCheckpoint(val *ethpb.Checkpoint) error {
|
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
|
|
|
|
2022-01-27 08:42:32 +00:00
|
|
|
b.previousJustifiedCheckpoint = val
|
2023-01-26 14:40:12 +00:00
|
|
|
b.markFieldAsDirty(types.PreviousJustifiedCheckpoint)
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetCurrentJustifiedCheckpoint for the beacon state.
|
|
|
|
func (b *BeaconState) SetCurrentJustifiedCheckpoint(val *ethpb.Checkpoint) error {
|
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
|
|
|
|
2022-01-27 08:42:32 +00:00
|
|
|
b.currentJustifiedCheckpoint = val
|
2023-01-26 14:40:12 +00:00
|
|
|
b.markFieldAsDirty(types.CurrentJustifiedCheckpoint)
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetFinalizedCheckpoint for the beacon state.
|
|
|
|
func (b *BeaconState) SetFinalizedCheckpoint(val *ethpb.Checkpoint) error {
|
|
|
|
b.lock.Lock()
|
|
|
|
defer b.lock.Unlock()
|
|
|
|
|
2022-01-27 08:42:32 +00:00
|
|
|
b.finalizedCheckpoint = val
|
2023-01-26 14:40:12 +00:00
|
|
|
b.markFieldAsDirty(types.FinalizedCheckpoint)
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil
|
|
|
|
}
|