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

milestone integrations #547

Merged
merged 30 commits into from Feb 14, 2019
Merged

milestone integrations #547

merged 30 commits into from Feb 14, 2019

Conversation

@almogdepaz
Copy link
Contributor

@almogdepaz almogdepaz commented Feb 14, 2019

No description provided.

alg.Tortoise.handleIncomingLayer(ll)
alg.callback(ll.Index())
new := alg.latestComplete()

This comment has been minimized.

@y0sher

y0sher Feb 14, 2019
Contributor

new is a lang keyword

@@ -116,7 +116,7 @@ func (ni *ninjaTortoise) processBlock(b *mesh.Block) {
ni.Debug("block votes %d", bid)
bl, found := ni.blocks[bid]
if !found {
panic("unknown block!, something went wrong ")
panic(fmt.Sprintf("error block not found ID %d", bid))

This comment has been minimized.

@y0sher

y0sher Feb 14, 2019
Contributor

should we panic in real life ?

This comment has been minimized.

@almogdepaz

almogdepaz Feb 14, 2019
Author Contributor

yup

if id > 0 {
if id == 1 {
res = append(res, config.GenesisId)
} else {
res, err = t.hareResult.GetResult(id - 1)

This comment has been minimized.

@antonlerner

antonlerner Feb 14, 2019
Member

get result will fail for id = 0

@@ -185,7 +185,7 @@ func (m *meshDB) handleLayerBlocks(ll *layerHandler) {

if err := m.blocks.Put(bl.ID().ToBytes(), bytes); err != nil {
log.Error("could not add bl to ", bl.ID(), " database ", err)
continue
return

This comment has been minimized.

@antonlerner

antonlerner Feb 14, 2019
Member

panic here, this should not happen, if we cant insert into DB we cant rely on our network image in meshdb anymore

}

idArr := make([]BlockID, 0, len(ids))
for i := range ids {

This comment has been minimized.

@antonlerner

antonlerner Feb 14, 2019
Member

we cant use a map to create this slice, the blocks must be in the same order in all nodes. iterating a map is random and therefore will not produce same results

for _, tx := range b.Txs {
//todo: think about these conversions.. are they needed?
txs = append(txs, SerializableTransaction2StateTransaction(&tx))
for _, b := range l.blocks {

This comment has been minimized.

@antonlerner

antonlerner Feb 14, 2019
Member

please sort blocks, layer in db may not be in the same order between nodes

@almogdepaz almogdepaz merged commit c264e88 into develop Feb 14, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@almogdepaz almogdepaz deleted the optimized_Tortoise_Integration branch Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants