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

Orphan blocks #395

Merged
merged 16 commits into from Jan 3, 2019
Merged

Orphan blocks #395

merged 16 commits into from Jan 3, 2019

Conversation

almogdepaz
Copy link
Contributor

No description provided.

mesh/block.go Outdated Show resolved Hide resolved
mesh/encode.go Outdated Show resolved Hide resolved
changed map type to struct
# Conflicts:
#	mesh/mesh.go
#	mesh/mesh_test.go
#	sync/syncer.go
#	sync/syncer_test.go
m.tortoise.HandleLateBlock(block) //todo should be thread safe?
return nil
}

//todo better thread safety
func (m *mesh) handleOrphanBlocks(block *Block) {
m.orphanBlocks.Put(block.ID().ToBytes(), TRUE)
Copy link
Contributor

Choose a reason for hiding this comment

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

lock mutex?

atomic.AddInt32(&m.orphanBlockCount, 1)
for b := range block.ViewEdges {
blockId := b.ToBytes()
if _, err := m.orphanBlocks.Get(blockId); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

what do we do when we get an error here?

@almogdepaz almogdepaz merged commit a13eca6 into develop Jan 3, 2019
@y0sher y0sher deleted the orphanBlocks branch January 14, 2019 17:08
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.

None yet

2 participants