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

wallet: add no_initial_sync argument to open_wallet rpc command. #9579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0xFFFC0000
Copy link
Collaborator

@0xFFFC0000 0xFFFC0000 commented Nov 18, 2024

Add refresh step when opening a wallet with open_wallet.

  1. add no_initial_sync argument to open_wallet rpc command.
  2. Clean --no-initial-sync implementation.
  3. Fix spelling error.

The interface for open_wallet has stayed the same. Passing no_initial_sync to open_wallet RPC will prevent open_wallet from doing a refresh after opening a wallet.

Open wallet with default refresh:

open_wallet': curl http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"open_wallet","params":{"filename":"WalletName","password":""}}' -H 'Content-Type: application/json'

Open wallet without refresh after opening wallet:

open_wallet': curl http://localhost:18082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"open_wallet","params":{"filename":"MainNetWallet","password":"", "no_initial_sync": true}}' -H 'Content-Type: application/json'

@plowsof
Copy link
Contributor

plowsof commented Nov 25, 2024

echoing my comment on the original --no-inital-sync pull request from mooo #8941 (comment) to say this is great. Adding this as an on the fly flag per open wallet means that devs will see this flag in a more prominent place in docs, instead of in a separate startup flag section. I will sanity check this now and update this comment

@plowsof
Copy link
Contributor

plowsof commented Nov 25, 2024

can you confirm my sanity check test?
starting wallet rpc (without --no-initial-sync / no open wallet)

./monero-wallet-rpc --disable-rpc-login --wallet-dir . --rpc-bind-port 58084 --log-level 2

test wallet has a height of 0. open test wallet without no_initial_sync:

curl http://localhost:58084/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"open_wallet","params":{"filename":"test","password":""}}' -H 'Content-Type: application/json'

i see:

2024-11-25 10:40:31.523	W Loaded wallet keys file, with public address: 44j98gLoxv6FKD9LwhtaH29DjWPHq3UoU1memboviCeSNViQtDUoBTg2yqmJDtj6MvjSgMk6mxz3F1Su7jRYK9mpMc6KGmZ
2024-11-25 10:40:31.552	I Trying to decrypt cache data
2024-11-25 10:40:31.630	I No message store file found: ./test.mms
2024-11-25 10:40:31.630	D /json_rpc[open_wallet] processed with 0/2264/0ms
2024-11-25 10:40:31.630	D Destructing connection #0 to 0.0.0.0
2024-11-25 10:40:42.632	D Pulling blocks: start_height 0
2024-11-25 10:40:42.632	D Reconnecting...
2024-11-25 10:40:42.789	W SSL peer has not been verified
2024-11-25 10:40:42.789	W SSL peer has not been verified
2024-11-25 10:40:42.789	W SSL peer has not been verified
2024-11-25 10:40:42.880	D SSL handshake success
2024-11-25 10:40:42.948	D Pulled blocks: blocks_start_height 425574, count 1000, height 426574, node height 3289068, pool info 2

exiting wallet-rpc and starting with the same params. then opening test with no_initial_sync:

curl http://localhost:58084/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"open_wallet","params":{"filename":"test","password":"", "no_initial_sync": true}}' -H 'Content-Type: application/json'

I should not see the same logs output as the original open_wallet curl without no_initial_sync?

@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/refresh-open_wallet branch from 66ca8b1 to ce935f7 Compare November 25, 2024 11:21
   * Clean --no-initial-sync implementation.
   * Fix spelling error.
@0xFFFC0000 0xFFFC0000 force-pushed the dev/0xfffc/refresh-open_wallet branch from ce935f7 to be87c56 Compare November 25, 2024 11:24
@0xFFFC0000
Copy link
Collaborator Author

@plowsof Yes, that is correct.

Good suggestion and I updated the PR.

Right now, when it does not sync, it will print a log : no-initial-sync passed. Not syncing the wallet..

@0xFFFC0000
Copy link
Collaborator Author

@plowsof

I misread you question.

I should not see the same logs output as the original open_wallet curl without no_initial_sync?

In original PR, the logs were exactly same. No special output for passing no-initial-sync.

That is not the case anymore. Right now, when you pass no-initial-sync whether to RPC call or as wallet flag, you will see a no-initial-sync passed. Not syncing the wallet in your log.

@plowsof
Copy link
Contributor

plowsof commented Nov 30, 2024

i confirm the 'time to begin syncing after opening a wallet' is significantly reduced with this PR. I used a rudimentary test grepping log files, comparing the opened wallet line to the "Pulled blocks" line that seemed to occur close enough to when wallet sync started.

Edit* bandwidth usage is addressed in #9574 another PR not here

I'm now running a test to see any bandwidth usage difference with an open -> close wallet file continuous loop

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.

2 participants