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

Blockchain and Distributed Tab Chains Behave Differently #7

Closed
grempe opened this issue Feb 18, 2017 · 4 comments
Closed

Blockchain and Distributed Tab Chains Behave Differently #7

grempe opened this issue Feb 18, 2017 · 4 comments

Comments

@grempe
Copy link

grempe commented Feb 18, 2017

I noticed, when experimenting with your excellent demo, that the chains on the blockchain and distributed tabs behave differently.

For example, on the blockchain tab when you modify the data field on the second block, which breaks the hash signature as expected, the next block in the chain reflects the proper (broken) hash in the Prev field. Also, when you mine the current block again, generating a good signature for the block, the next block in the chain (and all following) reflect the newly generated hashes in the Prev field as well. This works as expected.

However, on the Distributed tab, which to my thinking should behave identically, just with three parallel blockchains, the next and all following blocks do NOT update the Prev value to reflect reality. This means you would need to carry those values forward manually, where I should just be able to kepp clicking mine on successive blocks to get one of the chains to be divergent from all of the others (while still being internally consistent).

After cloning and testing it out I believe changing line 55 in the distributed code with the following diff would fix it:

https://github.com/anders94/blockchain-demo/blob/master/views/distributed.jade#L55

$ git diff
diff --git a/views/distributed.jade b/views/distributed.jade
index 8793610..49cb601 100644
--- a/views/distributed.jade
+++ b/views/distributed.jade
@@ -52,7 +52,7 @@ block content
           var l = Ladda.create(this);
           l.start();
           setTimeout(function() {
-              mine(block, chain);
+              mine(block, chain, true);
               l.stop();
             }, 250); // give UI time to update
         });

I think this also fixes the token page which does not currently break signatures if you modify a value in the data block.

@anders94
Copy link
Owner

Yeah, that's a good catch. I'll fix that. Thanks!

@anders94
Copy link
Owner

Fix: #8

@grempe
Copy link
Author

grempe commented Feb 22, 2017

Great! Thx

@grempe
Copy link
Author

grempe commented Feb 23, 2017

Still need this fix pushed out to the demo site I think. :-)

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

No branches or pull requests

2 participants