CityOfZion / neo-python

Python Node and SDK for the NEO 2.x blockchain. For NEO 3.x go to our successor project neo-mamba
https://neo-python.readthedocs.io/en/latest/
MIT License
313 stars 189 forks source link

Wallet & np-api-server issues #1020

Open jseagrave21 opened 5 years ago

jseagrave21 commented 5 years ago

Current behavior

When initializing np-api-server with a wallet,

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:

ixje commented 5 years ago

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
ixje commented 5 years ago

I provided a solution for issue 4 in your PR