-
Notifications
You must be signed in to change notification settings - Fork 173
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
getblockstats rpc call bug #1292
getblockstats rpc call bug #1292
Conversation
division by zero is undefined behaviour and the end result was this |
Floating point division by zero IS defined by IEEE 754. The problem is handling of NaN, +inf and -inf surreal numbers. |
src/rpcdataacq.cpp
Outdated
if (super_count > 0) | ||
result.pushKV("super_spacing_hrs", (((double)l_last_time-(double)l_first_time)/(double)super_count)/3600.0); | ||
else | ||
result.pushKV("super_spacing_hrs", "N/A"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should strive for not including "null" values in the JSON output, see https://google.github.io/styleguide/jsoncstyleguide.xml#Empty/Null_Property_Values
…d fail to handle a null float
7053eda
to
a18af8a
Compare
Added: - Linux nodes can now stake superblocks using forwarded contracts #1060 (@tomasbrod). Changed: - Replace interest with constant block reward #1160 (@tomasbrod). Fork is set to trigger at block 1420000. - Raise coinstake output count limit to 8 #1261 (@tomasbrod). - Port of Bitcoin hash implementation #1208 (@jamescowens). - Minor canges for the build documentation #1091 (@Lenni). - Allow sendmany to be used without an account specified #1158 (@Foggyx420). Fixed: - Fix `cpids` and `validcpids` not returning the correct data #1233 (@Foggyx420). - Fix `listsinceblock` not showing mined blocks to change addresses #501 (@Foggyx420). - Fix crash when raining using a locked wallet #1236 (@Foggyx420). - Fix invalid stake reward/fee calculation (@jamescowens). - Fix divide by zero bug in `getblockstats` RPC #1292 (@Foggyx420). - Bypass historical bad blocks on testnet #1252 (@Quezacoatl1). - Fix MacOS memorybarrier warnings #1193 (@ghost). Removed: - Remove neuralhash from the getpeerinfo and node stats #1123 (@Foggyx420). - Remove obsolete NN code #1121 (@Foggyx420). - Remove (lower) Mint Limiter #1212 (@tomasbrod).
Fix for the rpc call of getblockstats.
essentially what was happening was the univalue handles differently between ui and command line call/http call
The problem was the division by 0 when the super_count was 0 resulting in a result leaving an empty result in json reply. essentially when univalue tried to process the read on it the json was invalid.
as you can see
super_spacing_hrs