mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-29 16:13:47 +00:00
feat(worker): add chainId check in worker (#228)
* check chain id * Update miner/taiko_worker.go --------- Co-authored-by: David <david@taiko.xyz>
This commit is contained in:
parent
6094ec356d
commit
4ebcf6656c
1 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue