contrib: force (de)serialization to create params section incase there is none. #9574
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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