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

No description provided.

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

Choose a reason for hiding this comment

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

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))
Copy link
Contributor

Choose a reason for hiding this comment

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

should we panic in real life ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup

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

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

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
@almogdepaz almogdepaz deleted the optimized_Tortoise_Integration branch March 12, 2019 14:38
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

4 participants