mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
eth/fetcher: remove useless checks
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
6895e66b8c
commit
c357f136e7
1 changed files with 2 additions and 16 deletions
|
|
@ -437,23 +437,12 @@ func (f *TxFetcher) loop() {
|
|||
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 subErr <-chan error
|
||||
if f.chain != nil {
|
||||
headEventCh = make(chan core.ChainEvent, 10)
|
||||
sub := f.chain.SubscribeChainEvent(headEventCh)
|
||||
subErr = sub.Err()
|
||||
defer func() {
|
||||
sub.Unsubscribe()
|
||||
for {
|
||||
select {
|
||||
case <-headEventCh: // drain channel
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
defer sub.Unsubscribe()
|
||||
}
|
||||
|
||||
for {
|
||||
|
|
@ -895,9 +884,6 @@ func (f *TxFetcher) loop() {
|
|||
f.txOnChainCache.Add(tx.Hash(), struct{}{})
|
||||
}
|
||||
|
||||
case <-subErr:
|
||||
return
|
||||
|
||||
case <-f.quit:
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue