mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
eth/filters: dry
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
5cb56120b4
commit
a43785332f
1 changed files with 3 additions and 2 deletions
|
|
@ -37,6 +37,7 @@ import (
|
|||
var (
|
||||
errInvalidTopic = errors.New("invalid topic(s)")
|
||||
errFilterNotFound = errors.New("filter not found")
|
||||
errConnectDropped = errors.New("connection dropped")
|
||||
errInvalidToBlock = errors.New("log subscription does not support history block range")
|
||||
errInvalidFromBlock = errors.New("invalid from block")
|
||||
)
|
||||
|
|
@ -375,7 +376,7 @@ func (api *FilterAPI) histLogs(ctx context.Context, notifier notifier, rpcSub *r
|
|||
select {
|
||||
case <-notifier.Closed():
|
||||
rmLogsSub.Unsubscribe()
|
||||
return 0, errors.New("connection dropped")
|
||||
return 0, errConnectDropped
|
||||
case err := <-rpcSub.Err(): // client send an unsubscribe request
|
||||
rmLogsSub.Unsubscribe()
|
||||
return 0, err
|
||||
|
|
@ -402,7 +403,7 @@ func (api *FilterAPI) histLogs(ctx context.Context, notifier notifier, rpcSub *r
|
|||
for _, log := range rmLogs {
|
||||
select {
|
||||
case <-notifier.Closed():
|
||||
return head, errors.New("connection dropped")
|
||||
return head, errConnectDropped
|
||||
case err := <-rpcSub.Err(): // client send an unsubscribe request
|
||||
return head, err
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in a new issue