feat(consensus): introduce cache for the payloads (#380)

Co-authored-by: David <david@taiko.xyz>
This commit is contained in:
maskpp 2025-02-20 15:10:12 +08:00 committed by GitHub
parent 3792f9356b
commit 36430eb4f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -474,6 +474,11 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl
TxListHash: &txListHash,
}
id := args.Id()
// If we already are busy generating this work, then we do not need
// to start a second process.
if api.localBlocks.has(id) {
return valid(&id), nil
}
payload, err := api.eth.Miner().BuildPayload(args, false)
if err != nil {
log.Error("Failed to build payload", "err", err)