mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
eth/filters: more accurate check of live or hist
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
290904803e
commit
390a4b3018
1 changed files with 7 additions and 3 deletions
|
|
@ -299,8 +299,12 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isLiveFilter := true
|
||||||
|
if crit.FromBlock != nil {
|
||||||
|
isLiveFilter = crit.FromBlock.Sign() < 0
|
||||||
|
}
|
||||||
// do live filter only
|
// do live filter only
|
||||||
if crit.FromBlock == nil {
|
if isLiveFilter {
|
||||||
err := filterLiveLogs()
|
err := filterLiveLogs()
|
||||||
return rpcSub, err
|
return rpcSub, err
|
||||||
}
|
}
|
||||||
|
|
@ -346,11 +350,11 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
|
// range filter is done or error, let's also stop the rmLogs subscribe
|
||||||
|
rmLogsSub.Unsubscribe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// range filter is done, let's also stop the rmLogs subscribe
|
|
||||||
rmLogsSub.Unsubscribe()
|
|
||||||
break FORLOOP
|
break FORLOOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue