nano-node icon indicating copy to clipboard operation
nano-node copied to clipboard

Add "threshold" option to representatives RPC command, and a new "representative_count" command

Open expiredhotdog opened this issue 2 years ago • 3 comments

Summary

The representatives RPC command currently only has count and sorting options. While sorting does move very small / 0-weight reps to the bottom of the list, it does not preserve the original ordering of the list, and still returns very-small-weight reps if count is set high enough. The threshold option would only return representatives with weight greater than or equal to x.

representative_count would, as the name implies, return the total number of representatives. Currently this is only possible using representatives with count=-1, and manually counting up the total.

What problem would be solved by this feature?

These additions would benefit any software which needs to access data regarding network representatives beyond a superficial level. Besides being much more convenient for developers, this would also majorly decrease bandwidth requirements for any software using this data which does not have access to a local node.

Are there any previous requests for this feature?

As far as I'm aware, there has been no discussion of adding these particular features.

Do you have a suggested solution?

Yes, add threshold as an option for the representatives RPC, and implement representative_count functionality.

If this feature is approved, would you be willing to submit a pull request with the solution?

I am willing to collaborate

Possible solution

No response

Supporting files

No response

expiredhotdog avatar Sep 05 '22 02:09 expiredhotdog

Having a start option would also be extremely useful for paging, similar to delegators.

expiredhotdog avatar Sep 05 '22 18:09 expiredhotdog

Some paginating and sorting combinations we have are slightly broken. And threshold is always a good option to have. Are you willing and capable to code this? If yes, that would be great. Otherwise, it will have to wait until it becomes a high enough priority for the dev team to look at coding it.

dsiganos avatar Sep 07 '22 09:09 dsiganos

The start option sounds like possibly a complication too far, although, if it can be specified, documented and coded succinctly then it can be added.

dsiganos avatar Sep 07 '22 09:09 dsiganos