neo-python
neo-python copied to clipboard
Wallet & np-api-server issues
Current behavior
When initializing np-api-server with a wallet,
-
[x] 1. If the wallet does not exist, program does not automatically exit after displaying "Wallet file not found". The user must use "CTRL-C" to exit.
-
[x] 2. If the wrong password is entered, "CTRL-C" does not initialize a shutdown, regardless of the number of times it is entered. A hard shutdown of the program is required.
-
[x] 3. If the action is canceled before a password is entered, after "Wallet opening cancelled" is displayed, "CTRL-C" does not initialize a shutdown, regardless of the number of times it is entered. A hard shutdown of the program is required.
-
[x] 4. Once the user successfully enters the wallet password, "CTRL-C" does not initialize a shutdown, regardless of the number of times it is entered. A hard shutdown of the program is required, which could corrupt the open databases.
-
[x] NOTE: Similar behavior to issues 1-3 is exhibited when incorrectly setting minpeers and maxpeers.
Expected behavior
For issues 1-3, the program should automatically exit. For issue 4, "CTRL-C" should initialize a shutdown like it normally does.
How to reproduce
Initialize np-api-server as you normally would (i.e. np-api-server --privnet --port-rpc 20332 --port-rest 8080 --wallet <wallet path>
) and try each of the scenarios listed above.
Your environment
Let us know in what environment you're running into the issue:
- OS: Windows 10 Ubuntu 18.04
- neo-python version: neo-python v0.9.2-dev
- Python version: Python 3.7.0b3
Another issue I found while looking at your PR is: When your privatenet database is different from the one you're connecting to (e.g. because you restarted your docker image or single node) then you used to get a warning saying
Chain database in Chains/privnet is for a different private network than the current container. Consider deleting the Chain directory with 'rm -rf /Users/user/.neopython/Chains/privnet*'.
Now it is silently muted and requires a ctrl+c. It can be fixed by changing https://github.com/CityOfZion/neo-python/blob/5fe7d51ef14614ff1cd0681f8fe2cb3e2cb76557/neo/bin/api_server.py#L154-L155 to
elif args.privnet:
try:
settings.setup_privnet()
except PrivnetConnectionError as e:
print(e)
raise SystemExit
I provided a solution for issue 4 in your PR