-
Notifications
You must be signed in to change notification settings - Fork 786
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 stops when SBD supply is 0 #3258
Comments
I realized that on testnets it is skipped by |
Just for the record: |
mvandeberg
pushed a commit
that referenced
this issue
May 21, 2019
Closes #3258 Fix update_median_feed when total sbd is 0
mvandeberg
pushed a commit
that referenced
this issue
May 21, 2019
Closes #3258 Fix update_median_feed when total sbd is 0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue is related with the function
update_median_feed()
indatabase.cpp
.Expected behavior
If the SBD supply is 0 the blockchain takes the median feed price from witnesses.
Actual behavior
When the SBD supply is 0 everyone stop producing blocks.
How to reproduce
testneta new chain with 21 witnesses.Reason
The
update_median_feed()
function updates the feed price taking into account two things:However, if the SBD supply is zero, the haircut price throws an exception because both quote and base have to be greater than zero (to prevent division by 0). No witness can create the new block and therefore the blockchain freezes.
Line in question:
Low vulnerability
The unique way to reach 0 SBD in the mainnet is stopping printing SBD and converting all of them into STEEM, which is very unlikely. However, it becomes more relevant on testnets or private blockchains.
Solution
Only calculate the haircut price if the SBD supply is greater than zero, because in this case there is no risk of debt, the ratio is 0%.
The text was updated successfully, but these errors were encountered: