beacon/types: add beacon header in ChainHeadEvent

and change HeadBlock to types.Block
This commit is contained in:
Felix Lange 2024-03-14 22:11:46 +01:00
parent 722c60254c
commit 72bb344ce4
3 changed files with 8 additions and 7 deletions

View file

@ -17,7 +17,6 @@
package blsync package blsync
import ( import (
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/beacon/light/request" "github.com/ethereum/go-ethereum/beacon/light/request"
"github.com/ethereum/go-ethereum/beacon/light/sync" "github.com/ethereum/go-ethereum/beacon/light/sync"
"github.com/ethereum/go-ethereum/beacon/types" "github.com/ethereum/go-ethereum/beacon/types"
@ -137,7 +136,8 @@ func (s *beaconBlockSync) updateEventFeed() {
return return
} }
s.chainHeadFeed.Send(types.ChainHeadEvent{ s.chainHeadFeed.Send(types.ChainHeadEvent{
HeadBlock: engine.BlockToExecutableData(execBlock, nil, nil).ExecutionPayload, BeaconHead: head.Header,
Finalized: common.Hash(finality.Finalized.PayloadHeader.BlockHash()), Block: execBlock,
Finalized: common.Hash(finality.Finalized.PayloadHeader.BlockHash()),
}) })
} }

View file

@ -62,7 +62,7 @@ func TestBlockSync(t *testing.T) {
} }
select { select {
case event := <-headCh: case event := <-headCh:
headNumber = event.HeadBlock.Number headNumber = event.Block.NumberU64()
default: default:
} }
if headNumber != expNumber { if headNumber != expNumber {

View file

@ -20,10 +20,10 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/beacon/merkle" "github.com/ethereum/go-ethereum/beacon/merkle"
"github.com/ethereum/go-ethereum/beacon/params" "github.com/ethereum/go-ethereum/beacon/params"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
) )
// HeadInfo represents an unvalidated new head announcement. // HeadInfo represents an unvalidated new head announcement.
@ -185,6 +185,7 @@ func (u *FinalityUpdate) Validate() error {
// latest accepted head of the beacon chain, along with the hash of the latest // latest accepted head of the beacon chain, along with the hash of the latest
// finalized execution block. // finalized execution block.
type ChainHeadEvent struct { type ChainHeadEvent struct {
HeadBlock *engine.ExecutableData BeaconHead Header
Finalized common.Hash Block *types.Block
Finalized common.Hash
} }