prysm-pulse/beacon-chain/state/state-native/v3/getters_payload_header.go

24 lines
670 B
Go
Raw Normal View History

package v3
import (
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
)
// LatestExecutionPayloadHeader of the beacon state.
func (b *BeaconState) LatestExecutionPayloadHeader() (*ethpb.ExecutionPayloadHeader, error) {
if b.latestExecutionPayloadHeader == nil {
return nil, nil
}
b.lock.RLock()
defer b.lock.RUnlock()
return b.latestExecutionPayloadHeaderVal(), nil
}
// latestExecutionPayloadHeaderVal of the beacon state.
// This assumes that a lock is already held on BeaconState.
func (b *BeaconState) latestExecutionPayloadHeaderVal() *ethpb.ExecutionPayloadHeader {
return ethpb.CopyExecutionPayloadHeader(b.latestExecutionPayloadHeader)
}