Skip to content
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: force (de)serialization to create params section incase there is none. #9574

Conversation

0xFFFC0000
Copy link
Collaborator

@0xFFFC0000 0xFFFC0000 commented Nov 15, 2024

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 is false. When in fact it should be true [1]. ( The command I am running is default command curl http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"close_wallet"}' -H 'Content-Type: application/json' )

image

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] returns null 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.

  1. KV_SERIALIZE_OPT(autosave_current, true)

@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/fix-serialization-empty-field-issue branch from c812753 to e9adafa Compare November 16, 2024 20:23
@vtnerd
Copy link
Contributor

vtnerd commented Nov 19, 2024

The other solution would be

KV_SERIALIZE_OPT(params, t_param{})

in jsonrpc_structs.h. That might be better from a maintenance standpoint, but it's somewhat of a toss-up.

Copy link

@nahuhh nahuhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested for 12hrs with a open->close loop
release-rpc is the release version, master-rpc is this pr

Screenshot_20241213-164209.png

@luigi1111 luigi1111 merged commit 2f770a3 into monero-project:master Dec 23, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants