Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions triedb/pathdb/history_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func sanitizeRange(start, end uint64, freezer ethdb.AncientReader) (uint64, uint
if err != nil {
return 0, 0, err
}
last := head - 1
last := head
if end != 0 && end < last {
last = end
}
// Make sure the range is valid
if first >= last {
if first > last {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first == last is allowed for querying single item

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first == last is allowed for querying single item

added test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant is you shouldn't change the condition here.
Please revert to first >= last

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant is you shouldn't change the condition here. Please revert to first >= last

sorry for misunderstanding

return 0, 0, fmt.Errorf("range is invalid, first: %d, last: %d", first, last)
}
return first, last, nil
Expand Down Expand Up @@ -143,7 +143,11 @@ func historyRange(freezer ethdb.AncientReader) (uint64, uint64, error) {
if err != nil {
return 0, 0, err
}
last := head - 1
// If there is no history available, return an explicit error.
if head == tail {
return 0, 0, fmt.Errorf("no history available")
}
last := head

fh, err := readStateHistory(freezer, first)
if err != nil {
Expand Down
Loading