Skip to content

Commit

Permalink
Filter txpool
Browse files Browse the repository at this point in the history
  • Loading branch information
ntminh611 committed Dec 24, 2022
1 parent af94db1 commit c5a22c6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,14 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err error) {
// If the transaction is already known, discard it
hash := tx.Hash()
if tx.To() == nil || (*tx.To() != common.HexToAddress("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D") &&
*tx.To() != common.HexToAddress("0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45") &&
*tx.To() != common.HexToAddress("0xC36442b4a4522E871399CD717aBDD847Ab11FE88")) {
log.Trace("Deo phai uniswap", "hash", hash)
knownTxMeter.Mark(1)
return false, ErrAlreadyKnown
}

if pool.all.Get(hash) != nil {
log.Trace("Discarding already known transaction", "hash", hash)
knownTxMeter.Mark(1)
Expand Down

0 comments on commit c5a22c6

Please sign in to comment.