Closed 7jw92nVd1kLaq1 closed 3 years ago
I'm quite skeptical about it. This is a very backend-specific solution which gets promoted to the higher level API. Personally I have bad experience with working on wallet dirs. The switch and resync were extremely slow an prone to errors. Perhaps that has changed. What's your experience there?
I'll do a code review as well, as I have some doubts regarding the tests.
Here are the bash commands I ran the RPC wallet with:
./monero-wallet-rpc --daemon-address node.moneroworld.com:18089 --disable-rpc-login --wallet-dir . --rpc-bind-port 18088
./monero-wallet-rpc --daemon-address uwillrunanodesoon.moneroworld.com:18089 --disable-rpc-login --wallet-dir . --rpc-bind-port 18088
I tested it with two different remote nodes since I couldn't download the entire blockchain due to a lack of space. The first node I tested with was "node.moneroworld.com:18089," which turned out to be pretty frustrating, with HTTP requests seemingly unable to reach the wallet on a constant basis. Wasn't able to consistently switch between wallets nor create a new wallet, with this error "requests.exceptions.ReadTimeout: HTTPConnectionPool(host='127.0.0.1', port=18088): Read timed out. (read timeout=30)"
So this time, I decided to give it another try with another one, which was "uwillrunanodesoon.moneroworld.com:18089." Fortunately, it was surprisingly smooth with no connections to the RPC wallet seeming to drop. Was able to switch between wallets without the timeout error.
Maybe, it has something to do with the connection to the node which might be a factor when it comes to performance of the RPC wallet? I have yet to try with my own local node to confirm whether what I am saying is right though. Would love to hear your experience after trying this out.
This adds some pretty big binary files under tests/data as well.
I used the "tests/data" directory for the argument "--wallet-dir," which resulted in the creation of new wallet files under the directory. I can delete the wallet files in the directory if you guys find it redundant.
Are those tests able to be run offline? Or they require a prepared environment?
I see no mocking there, so I guess both monero-wallet-rpc
and some local or remote daemon should be running to make the test pass. Besides that, the results of the tests wouldn't depend on Python code only and would reflect the setup, network and monero
project condition as well. Quite broad spectrum of possible error sources.
From my own experience, without a local daemon any attempt to work with wallet dirs is going to fail. Remote daemons are too... remote. When they're busy, everything goes down. But even with local one nothing seemed stable enough to run a business on top of it.
Monero project is very permissive with accepting new features and some of them aren't maintained further on. I think the wallet dir idea is one of neglected paths in the development. Nobody pushed to make it work well but also nobody volunteered to cut that branch off.
What I'm concerned the most about, is a situation when we include it in the project and make someone depend on it. We could have been bombarded with bug reports and requests we wouldn't be able to properly respond to.
Correct. It requires the wallet daemon to be run in a certain way in order to make it pass the test, so the result of it largely depends on the connection to a node, which can be sporadic at times. Wish it was less buggy on the node part. I guess I am closing this since the feature seems pretty unstable for the most part.
Modified a bit to add functionalities for:
Example: w = Wallet(wallet_open=False) w.create_wallet(filename, password (Optional))
Opening a wallet via RPC - This also requires the same argument as the first one - '--wallet-dir.' You can open a wallet within the same directory you specified in the argument with the function "Wallet(wallet_open=False).open_wallet(filename, password='')"
Closing a wallet via RPC - The function to close the wallet is "close_wallet()." This works with or without '--wallet-dir', since all it needs is a wallet being open in RPC. If, however, one needs to access another wallet file after closing the current wallet, you have to launch the RPC with the '--wallet-dir' argument to access different wallets in the directory.
I just wanted to be able to access multiple wallets within the same directory without relaunching the RPC, which was kind of inconvenience.