Skip to content

Commit c357f13

Browse files
committed
eth/fetcher: remove useless checks
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
1 parent 6895e66 commit c357f13

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

eth/fetcher/tx_fetcher.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -437,23 +437,12 @@ func (f *TxFetcher) loop() {
437437
oldHead *types.Header
438438
)
439439

440-
//Subscribe to chain events to know when transactions are added to chain
440+
// Subscribe to chain events to know when transactions are added to chain
441441
var headEventCh chan core.ChainEvent
442-
var subErr <-chan error
443442
if f.chain != nil {
444443
headEventCh = make(chan core.ChainEvent, 10)
445444
sub := f.chain.SubscribeChainEvent(headEventCh)
446-
subErr = sub.Err()
447-
defer func() {
448-
sub.Unsubscribe()
449-
for {
450-
select {
451-
case <-headEventCh: // drain channel
452-
default:
453-
return
454-
}
455-
}
456-
}()
445+
defer sub.Unsubscribe()
457446
}
458447

459448
for {
@@ -895,9 +884,6 @@ func (f *TxFetcher) loop() {
895884
f.txOnChainCache.Add(tx.Hash(), struct{}{})
896885
}
897886

898-
case <-subErr:
899-
return
900-
901887
case <-f.quit:
902888
return
903889
}

0 commit comments

Comments
 (0)