re: #29409 (review)
Just a question: From what I gathered so far UniValue
is required in these interfaces for error handling (like here) and to pass around the ban map. Is that correct? It seems unfortunate to me that UniValue
types end up in the interfaces and need to be handled here. Is the intention to eventually refactor this?
In general there are lots of ways current interfaces are not ideal and can be improved over time, to improve performance (especially to reduce round trips), reduce dependencies, and provide more flexibility.
On UniValue specifically, handling UniValue exceptions could go away if wallet processes would start their own RPC servers on their own ports instead of getting RPC requests forwarded to them by the bitcoin-node process. That wouldn’t be hard to do, but it would be a UI change, and there’s a chicken and egg problem because it doesn’t really make sense to make wallets listen on different ports before wallets are able to run in separate processes.
UniValue is also used to pass settings between processes. For example when GUI settings are changed, the GUI calls the updateRwSetting() function which takes a univalue parameter to save the setting. In this case I think it makes sense for the interface to use univalues, since the settings are saved as JSON, though of course alternatives are possible and might be more ideal.
For the ban map, maybe univalue is not ideal for some reason, but it also might be better than defining a new serialization format. I don’t see a problem with the current approach in any of these cases, but making changes is always possible