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

untrusted peer downloader validation #67

Merged
merged 3 commits into from
Jun 18, 2018

Conversation

b00ris
Copy link

@b00ris b00ris commented Jun 15, 2018

closes #63

@b00ris b00ris requested review from themue and JekaMas June 15, 2018 12:00
les/fetcher.go Outdated
for n != nil {
if td = f.chain.GetTd(n.hash, n.number); td != nil {
if n.hash == h.Hash() {
Copy link

Choose a reason for hiding this comment

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

Could you add a few comments here?

Copy link

@themue themue left a comment

Choose a reason for hiding this comment

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

In case handling of lastTrustedHeader is okay document how it is ensured. Otherwise later maintainer could be sceptical too.

les/fetcher.go Outdated
@@ -523,6 +524,7 @@ func (f *lightFetcher) newFetcherDistReqForSync(bestHash common.Hash) *distReq {
go func() {
p := dp.(*peer)
p.Log().Debug("Synchronisation started")
f.lastTrustedHeader = f.chain.CurrentHeader()
Copy link

Choose a reason for hiding this comment

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

Is it safe setting this shared field asynchronously in goroutines?

les/fetcher.go Outdated
for last != nil {
if f.isTrustedHash(last.hash) {
current := f.chain.CurrentHeader()
for current != nil || current != f.lastTrustedHeader {
Copy link

Choose a reason for hiding this comment

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

Here is where I meant the comparison of the lastTrustedHeader set async in a goroutine.

@b00ris
Copy link
Author

b00ris commented Jun 16, 2018

@themue fixed

@themue
Copy link

themue commented Jun 16, 2018

@b00ris Seen my comment regarding setting it inside the goroutine?

Copy link

@themue themue left a comment

Choose a reason for hiding this comment

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

LGTM now. Thanks.

@b00ris b00ris merged commit 9f68c26 into ulc/master Jun 18, 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