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"
|
2022-08-16 12:20:13 +00:00
|
|
|
nativetypes "github.com/prysmaticlabs/prysm/v3/beacon-chain/state/state-native/types"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v3/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
|
2022-05-09 13:02:34 +00:00
|
|
|
b.markFieldAsDirty(nativetypes.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
|
2022-05-09 13:02:34 +00:00
|
|
|
b.markFieldAsDirty(nativetypes.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
|
2022-05-09 13:02:34 +00:00
|
|
|
b.markFieldAsDirty(nativetypes.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
|
2022-05-09 13:02:34 +00:00
|
|
|
b.markFieldAsDirty(nativetypes.FinalizedCheckpoint)
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil
|
|
|
|
}
|