inner error

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2023-10-20 20:34:39 +08:00
parent a15f45ca84
commit 257c935e82
4 changed files with 5 additions and 13 deletions

View file

@ -34,10 +34,9 @@ import (
)
var (
ErrInvalidBlockRange = errors.New("invalid from and to block combination: from > to")
errInvalidTopic = errors.New("invalid topic(s)")
errFilterNotFound = errors.New("filter not found")
errInvalidBlockRange = errors.New("invalid from and to block combination: from > to")
)
// filter is a helper struct that holds meta information over the filter type
@ -353,10 +352,6 @@ func (api *FilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*type
var err error
filter, err = api.sys.NewRangeFilter(begin, end, crit.Addresses, crit.Topics)
if err != nil {
// Compatible with old implement
if err == ErrInvalidBlockRange {
return nil, nil
}
return nil, err
}
}

View file

@ -45,7 +45,7 @@ type Filter struct {
func (sys *FilterSystem) NewRangeFilter(begin, end int64, addresses []common.Address, topics [][]common.Hash) (*Filter, error) {
// Fast exit if from > to
if begin > 0 && end > 0 && begin > end {
return nil, ErrInvalidBlockRange
return nil, errInvalidBlockRange
}
// Flatten the address and topic filter clauses into a single bloombits filter

View file

@ -331,7 +331,7 @@ func (es *EventSystem) SubscribeLogs(crit ethereum.FilterQuery, logs chan []*typ
if from >= 0 && to == rpc.LatestBlockNumber {
return es.subscribeLogs(crit, logs), nil
}
return nil, ErrInvalidBlockRange
return nil, errInvalidBlockRange
}
// subscribeMinedPendingLogs creates a subscription that returned mined and

View file

@ -1428,9 +1428,6 @@ func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria
// Construct the range filter
filter, err := r.filterSystem.NewRangeFilter(begin, end, addresses, topics)
if err != nil {
if err == filters.ErrInvalidBlockRange {
return nil, nil
}
return nil, err
}
return runFilter(ctx, r, filter)