eth/fetcher: remove useless checks

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2026-02-03 12:44:45 +01:00
parent 6895e66b8c
commit c357f136e7
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E

View file

@ -437,23 +437,12 @@ func (f *TxFetcher) loop() {
oldHead *types.Header oldHead *types.Header
) )
//Subscribe to chain events to know when transactions are added to chain // Subscribe to chain events to know when transactions are added to chain
var headEventCh chan core.ChainEvent var headEventCh chan core.ChainEvent
var subErr <-chan error
if f.chain != nil { if f.chain != nil {
headEventCh = make(chan core.ChainEvent, 10) headEventCh = make(chan core.ChainEvent, 10)
sub := f.chain.SubscribeChainEvent(headEventCh) sub := f.chain.SubscribeChainEvent(headEventCh)
subErr = sub.Err() defer sub.Unsubscribe()
defer func() {
sub.Unsubscribe()
for {
select {
case <-headEventCh: // drain channel
default:
return
}
}
}()
} }
for { for {
@ -895,9 +884,6 @@ func (f *TxFetcher) loop() {
f.txOnChainCache.Add(tx.Hash(), struct{}{}) f.txOnChainCache.Add(tx.Hash(), struct{}{})
} }
case <-subErr:
return
case <-f.quit: case <-f.quit:
return return
} }