mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fix(eth): write L1Origin even if the payload is already in the cache (#396)
This commit is contained in:
parent
516eff7ae9
commit
43a60b36ea
1 changed files with 8 additions and 6 deletions
|
|
@ -453,6 +453,12 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
|
||||||
return valid(nil), engine.InvalidPayloadAttributes.With(err)
|
return valid(nil), engine.InvalidPayloadAttributes.With(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// L1Origin **MUST NOT** be nil, it's a required field in PayloadAttributesV1.
|
||||||
|
l1Origin := payloadAttributes.L1Origin
|
||||||
|
|
||||||
|
// Set the block hash before inserting the L1Origin into database.
|
||||||
|
l1Origin.L2BlockHash = block.Hash()
|
||||||
|
|
||||||
// Use the tx list hash as the beacon root.
|
// Use the tx list hash as the beacon root.
|
||||||
txListHash := crypto.Keccak256Hash(payloadAttributes.BlockMetadata.TxList[:])
|
txListHash := crypto.Keccak256Hash(payloadAttributes.BlockMetadata.TxList[:])
|
||||||
// Cache the mined block for later use.
|
// Cache the mined block for later use.
|
||||||
|
|
@ -469,6 +475,8 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
|
||||||
// If we already are busy generating this work, then we do not need
|
// If we already are busy generating this work, then we do not need
|
||||||
// to start a second process.
|
// to start a second process.
|
||||||
if api.localBlocks.has(id) {
|
if api.localBlocks.has(id) {
|
||||||
|
// Write L1Origin even if the payload is already in the cache.
|
||||||
|
rawdb.WriteL1Origin(api.eth.ChainDb(), l1Origin.BlockID, l1Origin)
|
||||||
return valid(&id), nil
|
return valid(&id), nil
|
||||||
}
|
}
|
||||||
payload, err := api.eth.Miner().BuildPayload(args, false)
|
payload, err := api.eth.Miner().BuildPayload(args, false)
|
||||||
|
|
@ -481,12 +489,6 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
|
||||||
|
|
||||||
api.localBlocks.put(id, payload)
|
api.localBlocks.put(id, payload)
|
||||||
|
|
||||||
// L1Origin **MUST NOT** be nil, it's a required field in PayloadAttributesV1.
|
|
||||||
l1Origin := payloadAttributes.L1Origin
|
|
||||||
|
|
||||||
// Set the block hash before inserting the L1Origin into database.
|
|
||||||
l1Origin.L2BlockHash = block.Hash()
|
|
||||||
|
|
||||||
// Write L1Origin.
|
// Write L1Origin.
|
||||||
rawdb.WriteL1Origin(api.eth.ChainDb(), l1Origin.BlockID, l1Origin)
|
rawdb.WriteL1Origin(api.eth.ChainDb(), l1Origin.BlockID, l1Origin)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue