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

View file

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

View file

@ -20,10 +20,10 @@ import (
"errors"
"fmt"
"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/beacon/merkle"
"github.com/ethereum/go-ethereum/beacon/params"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)
// 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
// finalized execution block.
type ChainHeadEvent struct {
HeadBlock *engine.ExecutableData
Finalized common.Hash
BeaconHead Header
Block *types.Block
Finalized common.Hash
}