mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 20:11:21 +00:00
Fixed hive test on invalid transition payload (#4618)
* experiment #1 * experiment #2 * experiment #3 * experiment 4
This commit is contained in:
parent
c422b8c4da
commit
b980280785
@ -111,8 +111,25 @@ func (e *EngineImpl) ForkchoiceUpdatedV1(ctx context.Context, forkChoiceState *F
|
||||
return nil, err
|
||||
}
|
||||
|
||||
payloadStatus := convertPayloadStatus(reply.PayloadStatus)
|
||||
if reply.PayloadStatus.Status == remote.EngineStatus_INVALID && payloadStatus["latestValidHash"] != nil {
|
||||
tx, err := e.db.BeginRo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer tx.Rollback()
|
||||
latestValidHash := payloadStatus["latestValidHash"].(common.Hash)
|
||||
isValidHashPos, err := rawdb.IsPosBlock(tx, latestValidHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !isValidHashPos {
|
||||
payloadStatus["latestValidHash"] = common.Hash{}
|
||||
}
|
||||
}
|
||||
json := map[string]interface{}{
|
||||
"payloadStatus": convertPayloadStatus(reply.PayloadStatus),
|
||||
"payloadStatus": payloadStatus,
|
||||
}
|
||||
if reply.PayloadId != 0 {
|
||||
encodedPayloadId := make([]byte, 8)
|
||||
@ -128,13 +145,6 @@ func (e *EngineImpl) ForkchoiceUpdatedV1(ctx context.Context, forkChoiceState *F
|
||||
func (e *EngineImpl) NewPayloadV1(ctx context.Context, payload *ExecutionPayload) (map[string]interface{}, error) {
|
||||
log.Trace("Received NewPayload", "height", uint64(payload.BlockNumber), "hash", payload.BlockHash)
|
||||
|
||||
tx, err := e.db.BeginRo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer tx.Rollback()
|
||||
|
||||
var baseFee *uint256.Int
|
||||
if payload.BaseFeePerGas != nil {
|
||||
var overflow bool
|
||||
@ -172,6 +182,12 @@ func (e *EngineImpl) NewPayloadV1(ctx context.Context, payload *ExecutionPayload
|
||||
}
|
||||
payloadStatus := convertPayloadStatus(res)
|
||||
if payloadStatus["latestValidHash"] != nil {
|
||||
tx, err := e.db.BeginRo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer tx.Rollback()
|
||||
latestValidHash := payloadStatus["latestValidHash"].(common.Hash)
|
||||
isValidHashPos, err := rawdb.IsPosBlock(tx, latestValidHash)
|
||||
if err != nil {
|
||||
|
@ -898,6 +898,9 @@ func (hi *HeaderInserter) FeedHeaderPoS(db kv.GetPut, header *types.Header, hash
|
||||
return fmt.Errorf("[%s] failed to WriteTd: %w", hi.logPrefix, err)
|
||||
}
|
||||
rawdb.WriteHeader(db, header)
|
||||
if err = rawdb.WriteHeaderNumber(db, hash, blockHeight); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
hi.highest = blockHeight
|
||||
hi.highestHash = hash
|
||||
|
Loading…
Reference in New Issue
Block a user