2022-01-13 11:23:53 +00:00
|
|
|
package v3
|
|
|
|
|
|
|
|
import (
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
|
|
)
|
|
|
|
|
|
|
|
// LatestExecutionPayloadHeader of the beacon state.
|
|
|
|
func (b *BeaconState) LatestExecutionPayloadHeader() (*ethpb.ExecutionPayloadHeader, error) {
|
2022-02-01 00:32:39 +00:00
|
|
|
if b.latestExecutionPayloadHeader == nil {
|
2022-01-13 11:23:53 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
b.lock.RLock()
|
|
|
|
defer b.lock.RUnlock()
|
|
|
|
|
2022-02-01 00:32:39 +00:00
|
|
|
return b.latestExecutionPayloadHeaderVal(), nil
|
2022-01-13 11:23:53 +00:00
|
|
|
}
|
|
|
|
|
2022-02-01 00:32:39 +00:00
|
|
|
// latestExecutionPayloadHeaderVal of the beacon state.
|
2022-01-13 11:23:53 +00:00
|
|
|
// This assumes that a lock is already held on BeaconState.
|
2022-02-01 00:32:39 +00:00
|
|
|
func (b *BeaconState) latestExecutionPayloadHeaderVal() *ethpb.ExecutionPayloadHeader {
|
|
|
|
return ethpb.CopyExecutionPayloadHeader(b.latestExecutionPayloadHeader)
|
2022-01-13 11:23:53 +00:00
|
|
|
}
|