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

Add network proportion to homepage and /vspinfo (and revoked proportion) #264

Merged
merged 3 commits into from
Jun 8, 2021

Conversation

jholdstock
Copy link
Member

Proportion is calculated using the number of tickets currently registered with the VSP, divided by the total size of the network ticket pool as reported by getblockheader.

The value will only ever be an estimate because:

  • it's possible for a single ticket to be added to multiple VSPs.
  • vspd does not distinguish between immature and live tickets, whereas getblockheader only reports live tickets.
  • getblockheader is reporting the size of the ticket pool as of the previous block, not the current block.

Closes #206

Proportion is calculated using the number of tickets  currently registered with the VSP, divided by the total size of the network ticket pool as reported by `getblockheader`.

The value will only ever be an estimate because:

- it's possible for a single ticket to be added to multiple VSPs.
- vspd does not distinguish between immature and live tickets, whereas `getblockheader` only reports live tickets.
- `getblockheader` is reporting the size of the ticket pool as of the previous block, not the current block.
@xaur
Copy link

xaur commented Jun 2, 2021

If it will only ever be an estimate, how about reflecting that in the field name? e.g. networkproportionestimate. That makes the name long though :S

"networkproportion":0.04847841472045294

I think 17 decimal places is an overkill. The lowest non-zero proportion is 1 / 50,000 = 0.00002, assuming the ticket pool ever reaches 50K. Let's take a less rounded number, 1 / 49,998 ~= 0.000020001 - still only 9 places.

@jholdstock
Copy link
Member Author

I actually had all of those exact same thoughts myself. Eventually settled on using the shorter name rather than the more descriptive one, and used a float64 rather than a shorter float32 in the API simply to be more consistent with the other fields in the API.

I dont feel particularly strongly about either, and will happily change both to match your suggestions.

@jholdstock
Copy link
Member Author

Because this is a rather small PR and it hasnt received a technical review yet, I've included another commit which also displays the number of revoked tickets as a percentage

Screenshot from 2021-06-08 17-59-59

@jholdstock jholdstock changed the title Add network proportion to homepage and /vspinfo. Add network proportion to homepage and /vspinfo (and revoked proportion) Jun 8, 2021
@dajohi dajohi merged commit 9867f78 into decred:master Jun 8, 2021
@jholdstock jholdstock deleted the proportion branch January 25, 2022 09:50
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.

show vsp proportion
3 participants