mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
d17996f8b0
* Update V3 from V4 * Fix build v3 -> v4 * Update ssz * Update beacon_chain.pb.go * Fix formatter import * Update update-mockgen.sh comment to v4 * Fix conflicts. Pass build and tests * Fix test
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package state_native
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/blocks"
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces"
|
|
enginev1 "github.com/prysmaticlabs/prysm/v4/proto/engine/v1"
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/v4/runtime/version"
|
|
)
|
|
|
|
// LatestExecutionPayloadHeader of the beacon state.
|
|
func (b *BeaconState) LatestExecutionPayloadHeader() (interfaces.ExecutionData, error) {
|
|
if b.version < version.Bellatrix {
|
|
return nil, errNotSupported("LatestExecutionPayloadHeader", b.version)
|
|
}
|
|
|
|
b.lock.RLock()
|
|
defer b.lock.RUnlock()
|
|
|
|
if b.version == version.Bellatrix {
|
|
return blocks.WrappedExecutionPayloadHeader(b.latestExecutionPayloadHeaderVal())
|
|
}
|
|
return blocks.WrappedExecutionPayloadHeaderCapella(b.latestExecutionPayloadHeaderCapellaVal(), big.NewInt(0))
|
|
}
|
|
|
|
// latestExecutionPayloadHeaderVal of the beacon state.
|
|
// This assumes that a lock is already held on BeaconState.
|
|
func (b *BeaconState) latestExecutionPayloadHeaderVal() *enginev1.ExecutionPayloadHeader {
|
|
return ethpb.CopyExecutionPayloadHeader(b.latestExecutionPayloadHeader)
|
|
}
|
|
|
|
// latestExecutionPayloadHeaderCapellaVal of the beacon state.
|
|
// This assumes that a lock is already held on BeaconState.
|
|
func (b *BeaconState) latestExecutionPayloadHeaderCapellaVal() *enginev1.ExecutionPayloadHeaderCapella {
|
|
return ethpb.CopyExecutionPayloadHeaderCapella(b.latestExecutionPayloadHeaderCapella)
|
|
}
|