mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-05 19:05:03 +00:00
Fix reversed range
This commit is contained in:
parent
b635e0632c
commit
715a328d3d
2 changed files with 3 additions and 7 deletions
|
|
@ -471,10 +471,6 @@ func (api *FilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*type
|
|||
if crit.ToBlock != nil {
|
||||
end = crit.ToBlock.Int64()
|
||||
}
|
||||
// Block numbers below 0 are special cases.
|
||||
if begin > 0 && end > 0 && begin > end {
|
||||
return nil, errInvalidBlockRange
|
||||
}
|
||||
if begin >= 0 && begin < int64(api.events.backend.HistoryPruningCutoff()) {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,6 +143,9 @@ func (f *Filter) Logs(ctx context.Context) ([]*types.Log, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if begin > end {
|
||||
return nil, errInvalidBlockRange
|
||||
}
|
||||
return f.rangeLogs(ctx, begin, end)
|
||||
}
|
||||
|
||||
|
|
@ -383,9 +386,6 @@ func (f *Filter) rangeLogs(ctx context.Context, firstBlock, lastBlock uint64) ([
|
|||
}()
|
||||
}
|
||||
|
||||
if firstBlock > lastBlock {
|
||||
return nil, nil
|
||||
}
|
||||
mb := f.sys.backend.NewMatcherBackend()
|
||||
defer mb.Close()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue