mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
899d1e4eaf
- Replaces the wallet RPC classes with ones like the core RPC server (with serialization code moved into a new .cpp file). - Restricted commands are now carried through the RPC serialization types (by inheriting from RESTRICTED instead of RPC_COMMAND) and restrictions are handled in one place rather than being handled in each of the 49 restricted endpoints. This differs a little from how the core http server works (which has a PUBLIC base class) because for the wallet rpc server unrestricted really doesn't mean "public", it means something closer to view-only. - GET_TRANSFERS_CSV is now restricted (it looks like an oversight that it wasn't before since GET_TRANSFERS is restricted) - GET_ADDRESS_BOOK_ENTRY is now restricted. Since restricted mode is meant to provide something like view-only access, it doesn't make much sense that address book entries were available. - Use uWebSockets to provide the wallet RPC server HTTP functionality. This version is quite a bit simpler than the core RPC version since it doesn't support multithreaded (parallel) requests, and so we don't have to worry about queuing jobs. - Converted all the numeric wallet rpc error codes defines to constexprs - Changed how endpoints get called; previous this was called: bool on_some_endpoint(const wallet_rpc::COMMAND_RPC_SOME_ENDPOINT::request& req, wallet_rpc::COMMAND_RPC_SOME_ENDPOINT::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL) This PR changes it similarly to how core_rpc_server's endpoints work: wallet_rpc::SOME_ENDPOINT invoke(wallet_rpc::COMMAND_RPC_SOME_ENDPOINT::request&& req); That is: - the response is now returned - the request is provided by mutable rvalue reference - the error object is gone (just throw instead) - the connection_context is gone (it was not used at all by any wallet rpc endpoint). - Consolidated most of the (identical) exception handling to the RPC method invocation point rather than needing to repeat it in each individual endpoint. This means each endpoint's `invoke` method can now just throw (or not catch) exceptions. Some try/catches are still there because they are converting one type of exception into another, but the generic ones that return a generic error are gone. - Removed all remaining epee http code. - DRYed out some wallet rpc code. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
cn_deserialize.cpp | ||
dns_checks.cpp | ||
object_sizes.cpp |