cosme12 / SimpleCoin

Just a really simple, insecure and incomplete implementation of a blockchain for a cryptocurrency made in Python as educational material. In other words, a simple Bitcoin clone.
http://copitosystem.com
MIT License
1.78k stars 397 forks source link

The doubt of 'start_time' assignment at line 77 in the mainer.py file #34

Closed zhuofanxu closed 6 years ago

zhuofanxu commented 6 years ago

2018-03-12 15 39 36

cosme12 commented 6 years ago

The % checks the remaining of the division between x and 60. So lets say in line 79 we have 110%60 that gives us 50 so the condition is not meet. On the other hand if we have 120%60 that gives us 0 (the division between 120 and 60 is 2 but the remaining is 0) so the condition is satisfied. This work for any multiplus (not sure if that is the word) of 60. Example: 60,120,180,240,300... and so on. Hope that clears your doubt if that was the question.

zhuofanxu commented 6 years ago

@cosme12 Thanks for the reply. Yea. the condition itself at 79 is okay. what i mean is that you assign time.time() to 'start_time' at line 72 first time and at line 77 for the second time. The second assignment make the if condition expression always equal to 0. not the 60,120,180,240....

cosme12 commented 6 years ago

Oh, now I see what you mean. Should we remove line 77 and keep start_time outside the while condition?

zhuofanxu commented 6 years ago

yes

cosme12 commented 6 years ago

Feel free to push a pull request to v1.1.0 branch so I can add it and you get listed as collaborator. Thanks for spotting the bug!