diff --git a/miner/taiko_worker.go b/miner/taiko_worker.go index 393f1c1d90b2..2aa04923a7bd 100644 --- a/miner/taiko_worker.go +++ b/miner/taiko_worker.go @@ -172,6 +172,15 @@ func (w *worker) sealBlockWith( env.gasPool = new(core.GasPool).AddGas(gasLimit) for i, tx := range txs { + if tx.ChainId().Cmp(w.chainConfig.ChainID) != 0 { + if i == 0 { + return nil, fmt.Errorf("anchor tx with invalid chain id, expected: %v, actual: %v", w.chainConfig.ChainID, tx.ChainId()) + } else { + log.Debug("Skip an proposed transaction with invalid chain id", "hash", tx.Hash(), "expect", w.chainConfig.ChainID, "actual", tx.ChainId()) + continue + } + } + if i == 0 { if err := tx.MarkAsAnchor(); err != nil { return nil, err