mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-15 22:48:19 +00:00
6406afc6cf
* Native beacon state: v3 * nogo_config * remove duplicated bazel rule * gzl * fix unnecessary assignment * review Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package v3
|
|
|
|
// CurrentEpochParticipation corresponding to participation bits on the beacon chain.
|
|
func (b *BeaconState) CurrentEpochParticipation() ([]byte, error) {
|
|
if b.currentEpochParticipation == nil {
|
|
return nil, nil
|
|
}
|
|
|
|
b.lock.RLock()
|
|
defer b.lock.RUnlock()
|
|
|
|
return b.currentEpochParticipationVal(), nil
|
|
}
|
|
|
|
// PreviousEpochParticipation corresponding to participation bits on the beacon chain.
|
|
func (b *BeaconState) PreviousEpochParticipation() ([]byte, error) {
|
|
if b.previousEpochParticipation == nil {
|
|
return nil, nil
|
|
}
|
|
|
|
b.lock.RLock()
|
|
defer b.lock.RUnlock()
|
|
|
|
return b.previousEpochParticipationVal(), nil
|
|
}
|
|
|
|
// currentEpochParticipationVal corresponding to participation bits on the beacon chain.
|
|
// This assumes that a lock is already held on BeaconState.
|
|
func (b *BeaconState) currentEpochParticipationVal() []byte {
|
|
tmp := make([]byte, len(b.currentEpochParticipation))
|
|
copy(tmp, b.currentEpochParticipation)
|
|
return tmp
|
|
}
|
|
|
|
// previousEpochParticipationVal corresponding to participation bits on the beacon chain.
|
|
// This assumes that a lock is already held on BeaconState.
|
|
func (b *BeaconState) previousEpochParticipationVal() []byte {
|
|
tmp := make([]byte, len(b.previousEpochParticipation))
|
|
copy(tmp, b.previousEpochParticipation)
|
|
return tmp
|
|
}
|