openvcash / vcash

A decentralized currency for the internet.
https://vcash.info
GNU Affero General Public License v3.0
36 stars 35 forks source link

Use some data structure to store all rpc commands #6

Open ghost opened 7 years ago

ghost commented 7 years ago

Now that the GUI has autocomplete for RPC commands, a good idea would be to have some data structure storing all those commands, so that the GUI would use that information too and cannot get outdated when a new command is added.

As all methods for implementing RPC commands have the same type, we could use a map from strings to functions. This huge if-else:

https://github.com/openvcash/vcash/blob/master/coin/src/rpc_connection.cpp#L520

could then be replaced with a single find on the map.

xCoreDev commented 7 years ago

Some are sending the request, and some not like json_getinfo(). But yes, a more structured methods list who can be called from the GUI can be nice.

ghost commented 7 years ago

I didn't see that one, but we could make all RPC commands have the same type. That one could just ignore its argument.