Skip to content

Commit af424a5

Browse files
committed
correctly unset fields
1 parent 732eae8 commit af424a5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

consensus/clique/clique.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,10 @@ func (c *Clique) Prepare(chain consensus.ChainHeaderReader, header *types.Header
526526
header.Coinbase = common.Address{}
527527
header.Nonce = types.BlockNonce{}
528528

529+
// Unset EuclidV2-related fields
530+
header.BlockSignature = nil
531+
header.IsEuclidV2 = false
532+
529533
number := header.Number.Uint64()
530534
// Assemble the voting snapshot to check which votes make sense
531535
snap, err := c.snapshot(chain, number-1, header.ParentHash, nil)

miner/scroll_worker.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,16 @@ func (w *worker) newWork(now time.Time, parentHash common.Hash, reorging bool, r
519519
// since we can only include MessageQueueV2 messages after EuclidV2.
520520
l1MessagesV1 := rawdb.ReadL1MessagesV1From(w.eth.ChainDb(), nextL1MsgIndex, 1)
521521
if len(l1MessagesV1) > 0 {
522+
// Reset Extra (it was unset by SystemContract)
523+
header.Extra = w.extra
524+
522525
// Backdate the block to the parent block's timestamp -> not yet EuclidV2
523526
parentTime := parent.Time()
524527
log.Warn("Backdating header timestamp to ensure it precedes the EuclidV2 transition", "blockNumber", header.Number, "oldTime", header.Time, "newTime", parentTime)
525528

526-
// Run Prepare again, this time we provide a timestamp override, so it will use Clique
529+
// Run Prepare again, this time we provide a timestamp override, so it will use Clique.
530+
// Note: Clique should correctly unset or overwrite any fields previously set by SystemConfig,
531+
// with the exception of Extra that was reset above.
527532
prepareStart := time.Now()
528533
if err := w.engine.Prepare(w.chain, header, &parentTime); err != nil {
529534
return fmt.Errorf("failed to prepare header for mining: %w", err)

0 commit comments

Comments
 (0)