github.com/prysmaticlabs/prysm@v1.4.4/beacon-chain/state/v1/setters_checkpoint.go (about) 1 package v1 2 3 import ( 4 "github.com/prysmaticlabs/go-bitfield" 5 ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1" 6 ) 7 8 // SetJustificationBits for the beacon state. 9 func (b *BeaconState) SetJustificationBits(val bitfield.Bitvector4) error { 10 if !b.hasInnerState() { 11 return ErrNilInnerState 12 } 13 b.lock.Lock() 14 defer b.lock.Unlock() 15 16 b.state.JustificationBits = val 17 b.markFieldAsDirty(justificationBits) 18 return nil 19 } 20 21 // SetPreviousJustifiedCheckpoint for the beacon state. 22 func (b *BeaconState) SetPreviousJustifiedCheckpoint(val *ethpb.Checkpoint) error { 23 if !b.hasInnerState() { 24 return ErrNilInnerState 25 } 26 b.lock.Lock() 27 defer b.lock.Unlock() 28 29 b.state.PreviousJustifiedCheckpoint = val 30 b.markFieldAsDirty(previousJustifiedCheckpoint) 31 return nil 32 } 33 34 // SetCurrentJustifiedCheckpoint for the beacon state. 35 func (b *BeaconState) SetCurrentJustifiedCheckpoint(val *ethpb.Checkpoint) error { 36 if !b.hasInnerState() { 37 return ErrNilInnerState 38 } 39 b.lock.Lock() 40 defer b.lock.Unlock() 41 42 b.state.CurrentJustifiedCheckpoint = val 43 b.markFieldAsDirty(currentJustifiedCheckpoint) 44 return nil 45 } 46 47 // SetFinalizedCheckpoint for the beacon state. 48 func (b *BeaconState) SetFinalizedCheckpoint(val *ethpb.Checkpoint) error { 49 if !b.hasInnerState() { 50 return ErrNilInnerState 51 } 52 b.lock.Lock() 53 defer b.lock.Unlock() 54 55 b.state.FinalizedCheckpoint = val 56 b.markFieldAsDirty(finalizedCheckpoint) 57 return nil 58 }