mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
inner error
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
a15f45ca84
commit
257c935e82
4 changed files with 5 additions and 13 deletions
|
|
@ -34,10 +34,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrInvalidBlockRange = errors.New("invalid from and to block combination: from > to")
|
|
||||||
|
|
||||||
errInvalidTopic = errors.New("invalid topic(s)")
|
errInvalidTopic = errors.New("invalid topic(s)")
|
||||||
errFilterNotFound = errors.New("filter not found")
|
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
|
// 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
|
var err error
|
||||||
filter, err = api.sys.NewRangeFilter(begin, end, crit.Addresses, crit.Topics)
|
filter, err = api.sys.NewRangeFilter(begin, end, crit.Addresses, crit.Topics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Compatible with old implement
|
|
||||||
if err == ErrInvalidBlockRange {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ type Filter struct {
|
||||||
func (sys *FilterSystem) NewRangeFilter(begin, end int64, addresses []common.Address, topics [][]common.Hash) (*Filter, error) {
|
func (sys *FilterSystem) NewRangeFilter(begin, end int64, addresses []common.Address, topics [][]common.Hash) (*Filter, error) {
|
||||||
// Fast exit if from > to
|
// Fast exit if from > to
|
||||||
if begin > 0 && end > 0 && begin > end {
|
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
|
// Flatten the address and topic filter clauses into a single bloombits filter
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ func (es *EventSystem) SubscribeLogs(crit ethereum.FilterQuery, logs chan []*typ
|
||||||
if from >= 0 && to == rpc.LatestBlockNumber {
|
if from >= 0 && to == rpc.LatestBlockNumber {
|
||||||
return es.subscribeLogs(crit, logs), nil
|
return es.subscribeLogs(crit, logs), nil
|
||||||
}
|
}
|
||||||
return nil, ErrInvalidBlockRange
|
return nil, errInvalidBlockRange
|
||||||
}
|
}
|
||||||
|
|
||||||
// subscribeMinedPendingLogs creates a subscription that returned mined and
|
// subscribeMinedPendingLogs creates a subscription that returned mined and
|
||||||
|
|
|
||||||
|
|
@ -1428,9 +1428,6 @@ func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria
|
||||||
// Construct the range filter
|
// Construct the range filter
|
||||||
filter, err := r.filterSystem.NewRangeFilter(begin, end, addresses, topics)
|
filter, err := r.filterSystem.NewRangeFilter(begin, end, addresses, topics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == filters.ErrInvalidBlockRange {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return runFilter(ctx, r, filter)
|
return runFilter(ctx, r, filter)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue