From 1559979671e6aa881bf7afcb567f85aae1367f13 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Thu, 18 Dec 2025 09:57:15 +0100 Subject: [PATCH] eth/handler: simplify code Signed-off-by: Csaba Kiraly --- eth/handler.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/eth/handler.go b/eth/handler.go index 41a09818f6..6c9d267cea 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -179,18 +179,12 @@ func newHandler(config *handlerConfig) (*handler, error) { addTxs := func(txs []*types.Transaction) []error { return h.txpool.Add(txs, false) } - hasTx := func(hash common.Hash) bool { - return h.txpool.Has(hash) - } - chainTx := func(hash common.Hash) bool { - // check on chain (no need to check limbo separately, as chain checks limbo too) - return h.chain.HasCanonicalTransaction(hash, true) - } - validateMeta := func(tx common.Hash, kind byte) error { - if hasTx(tx) { + validateMeta := func(hash common.Hash, kind byte) error { + if h.txpool.Has(hash) { return txpool.ErrAlreadyKnown } - if chainTx(tx) { + // check on chain as well (no need to check limbo separately, as chain checks limbo too) + if h.chain.HasCanonicalTransaction(hash, true) { return txpool.ErrAlreadyKnown } if !h.txpool.FilterType(kind) {