-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
contrib: fix serialization not calling load when only child is opt #9570
contrib: fix serialization not calling load when only child is opt #9570
Conversation
This might be a bad idea. The storage class assumes that More importantly, shouldn't this return a JSON error though, since there is no |
Normally JSON-RPC doesn't require params:
|
I have a question. I am not sure about the (infinite) loop thing. Can you explain it in a little bit more detail?
|
This is the solution I suggested: #9573 it will add the params field for JSON-RPC if it is missing. The error for a missing field not being returned though is also an issue that should be fixed. |
f8fdb6a
to
d8c4667
Compare
I added few testcases to PR. The important test is:
|
I am closing this PR. and re-opening #9574 PR. |
Even though this is closed, I will answer.
I don't think this is possible after further thought. However, it does "pollute" the root namespace into other contexts, so it's possibly still undesired. Your other solution is funky, but at least fixes all of the problems without introducing other issues. |
The problem is
monero-wallet-rpc
does not save the state of the wallet when closing the wallet.As you can see in the image below, the value of
autosave_current
isfalse
. When in fact it should betrue
[1]. ( The command I am running is default commandcurl http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"close_wallet"}' -H 'Content-Type: application/json'
)The reason for this bug is when the only child of the key-value serialization object is optional ( as is the case with the
close_wallet
), we don't call the function_load
of the object. This line [2] returnsnull
and therefore we don't call_load
method, which initializes the object. Whether the child section is null or not, we want to call_load
method, to make sure the correct initialization.monero/src/wallet/wallet_rpc_server_commands_defs.h
Line 2199 in 893916a
monero/contrib/epee/include/serialization/keyvalue_serialization_overloads.h
Line 80 in 893916a