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
|
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue