mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
HeadersPOS: to use snapshots (#4178)
This commit is contained in:
parent
75b93aca47
commit
55a4fa75b4
@ -179,7 +179,7 @@ func HeadersPOS(
|
||||
cfg.hd.ClearPendingPayloadStatus()
|
||||
|
||||
if forkChoiceInsteadOfNewPayload {
|
||||
if err := startHandlingForkChoice(forkChoiceMessage, status, requestId, s, u, ctx, tx, cfg, headerInserter); err != nil {
|
||||
if err := startHandlingForkChoice(forkChoiceMessage, status, requestId, s, u, ctx, tx, cfg, headerInserter, cfg.blockReader); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
@ -242,6 +242,7 @@ func startHandlingForkChoice(
|
||||
tx kv.RwTx,
|
||||
cfg HeadersCfg,
|
||||
headerInserter *headerdownload.HeaderInserter,
|
||||
headerReader interfaces.HeaderReader,
|
||||
) error {
|
||||
headerHash := forkChoice.HeadBlockHash
|
||||
log.Info(fmt.Sprintf("[%s] Handling fork choice", s.LogPrefix()), "headerHash", headerHash)
|
||||
@ -307,7 +308,10 @@ func startHandlingForkChoice(
|
||||
|
||||
forkingPoint := uint64(0)
|
||||
if headerNumber > 0 {
|
||||
parent := rawdb.ReadHeader(tx, header.ParentHash, headerNumber-1)
|
||||
parent, err := headerReader.Header(ctx, tx, header.ParentHash, headerNumber-1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
forkingPoint, err = headerInserter.ForkingPoint(tx, header, parent)
|
||||
if err != nil {
|
||||
if requestStatus == engineapi.New {
|
||||
@ -439,7 +443,10 @@ func handleNewPayload(
|
||||
return nil
|
||||
}
|
||||
|
||||
parent := rawdb.ReadHeader(tx, header.ParentHash, headerNumber-1)
|
||||
parent, err := cfg.blockReader.Header(ctx, tx, header.ParentHash, headerNumber-1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if parent == nil {
|
||||
log.Info(fmt.Sprintf("[%s] New payload missing parent", s.LogPrefix()))
|
||||
hashToDownload := header.ParentHash
|
||||
|
Loading…
Reference in New Issue
Block a user