From 46cbfe405d3b4c86ebf92f35e47eeff243d6974c Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Tue, 13 Aug 2024 16:22:48 +0800 Subject: [PATCH] eth/fetcher: drop the duplicated sanitize --- eth/fetcher/tx_fetcher.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/eth/fetcher/tx_fetcher.go b/eth/fetcher/tx_fetcher.go index 7ea64ef459..a113155009 100644 --- a/eth/fetcher/tx_fetcher.go +++ b/eth/fetcher/tx_fetcher.go @@ -237,12 +237,6 @@ func NewTxFetcherForTests( // Notify announces the fetcher of the potential availability of a new batch of // transactions in the network. func (f *TxFetcher) Notify(peer string, types []byte, sizes []uint32, hashes []common.Hash) error { - // Sanitize the announcements. Transaction metadata has been available since eth68, - // and all legacy eth protocols have been deprecated. Therefore, metadata is always - // expected in the announcement. - if len(types) != len(sizes) || len(types) != len(hashes) { - return errors.New("invalid transaction announcements") - } // Keep track of all the announced transactions txAnnounceInMeter.Mark(int64(len(hashes))) @@ -266,6 +260,10 @@ func (f *TxFetcher) Notify(peer string, types []byte, sizes []uint32, hashes []c underpriced++ default: unknownHashes = append(unknownHashes, hash) + + // Transaction metadata has been available since eth68, and all + // legacy eth protocols (prior to eth68) have been deprecated. + // Therefore, metadata is always expected in the announcement. unknownMetas = append(unknownMetas, &txMetadata{kind: types[i], size: sizes[i]}) } }