Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ulc/rewiew update #69

Merged
merged 4 commits into from
Jul 25, 2018
Merged

Ulc/rewiew update #69

merged 4 commits into from
Jul 25, 2018

Conversation

b00ris
Copy link

@b00ris b00ris commented Jul 9, 2018

No description provided.

@b00ris b00ris requested a review from JekaMas July 9, 2018 07:56
les/fetcher.go Outdated
if canonical.Number.Uint64() > f.lastTrustedHeader.Number.Uint64() {
canonical = f.chain.GetHeaderByNumber(f.lastTrustedHeader.Number.Uint64())
}
ancestorHash := rawdb.FindCommonAncestor(f.pm.chainDb, canonical, f.lastTrustedHeader).Hash()

Choose a reason for hiding this comment

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

I did not write this in my previous review but I'd add a check to avoid panic if the common ancestor header is nil. In that case print an error log.

les/fetcher.go Outdated
canonical = f.chain.GetHeaderByNumber(f.lastTrustedHeader.Number.Uint64())
}
ancestorHash := rawdb.FindCommonAncestor(f.pm.chainDb, canonical, f.lastTrustedHeader).Hash()
for current.Hash() != f.lastTrustedHeader.Hash() || current.Hash() != ancestorHash {

Choose a reason for hiding this comment

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

This condition does not make sense. Maybe you wanted to use &&.

les/fetcher.go Outdated
}
ancestorHash := rawdb.FindCommonAncestor(f.pm.chainDb, canonical, f.lastTrustedHeader).Hash()
for current.Hash() != f.lastTrustedHeader.Hash() || current.Hash() != ancestorHash {
if current == nil {

Choose a reason for hiding this comment

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

This check does not make sense here, current.Hash() would have already panic-ed if current is nil. Check it at the end, after loading the new value.

Copy link
Author

Choose a reason for hiding this comment

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

done

@b00ris b00ris merged commit 3fabf24 into ulc/master Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants