Skip to content

Commit

Permalink
Filter out bad tx with wrong chain id during block building phase. (#…
Browse files Browse the repository at this point in the history
…4783)

* filter out bad tx with wrong chain id

* report bad txs

Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
  • Loading branch information
Giulio2002 and giuliorebuffo committed Jul 22, 2022
1 parent 66758c7 commit 1d378b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions eth/stagedsync/stage_mining_create_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func SpawnMiningCreateBlockStage(s *StageState, tx kv.RwTx, cfg MiningCreateBloc
if err != nil {
return err
}
if transaction.GetChainID().ToBig().Cmp(cfg.chainConfig.ChainID) != 0 {
continue
}
txs = append(txs, transaction)
}
var sender common.Address
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ledgerwatch/erigon
go 1.18

require (
github.com/ledgerwatch/erigon-lib v0.0.0-20220720144911-046e4165b52a
github.com/ledgerwatch/erigon-lib v0.0.0-20220721212928-1331bb661a22
github.com/ledgerwatch/erigon-snapshot v1.0.0
github.com/ledgerwatch/log/v3 v3.4.1
github.com/ledgerwatch/secp256k1 v1.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170224010052-a616ab194758 h1:0D5M2HQSGD3PYPwICLl+/9oulQauOuETfgFvhBDffs0=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/ledgerwatch/erigon-lib v0.0.0-20220720144911-046e4165b52a h1:fRjDLDbieEy48O5BvMf1+ib8loZMA3nSiRtjxbuIsYw=
github.com/ledgerwatch/erigon-lib v0.0.0-20220720144911-046e4165b52a/go.mod h1:mq8M03qcnaqXZ/yjNuWoyZQ5V8r5JbXw5JYmy4WNUZQ=
github.com/ledgerwatch/erigon-lib v0.0.0-20220721212928-1331bb661a22 h1:cGxOEtCnkVzX+RcGQbQHiDuV8dQHnGqcwTFl9q8Hnkg=
github.com/ledgerwatch/erigon-lib v0.0.0-20220721212928-1331bb661a22/go.mod h1:mq8M03qcnaqXZ/yjNuWoyZQ5V8r5JbXw5JYmy4WNUZQ=
github.com/ledgerwatch/erigon-snapshot v1.0.0 h1:bp/7xoPdM5lK7LFdqEMH008RZmqxMZV0RUVEQiWs7v4=
github.com/ledgerwatch/erigon-snapshot v1.0.0/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo=
github.com/ledgerwatch/log/v3 v3.4.1 h1:/xGwlVulXnsO9Uq+tzaExc8OWmXXHU0dnLalpbnY5Bc=
Expand Down

0 comments on commit 1d378b6

Please sign in to comment.