peerplays-network / python-peerplays

This is a communications library which allows interface with the Peerplays blockchain directly and without the need for a cli_wallet. It provides a wallet interface and can construct any kind of transactions and properly sign them for broadcast.
MIT License
22 stars 13 forks source link

Corrected help message for createwallet #31

Closed farisshajahan closed 4 years ago

farisshajahan commented 5 years ago

This fixes issue #30 Help message for createwallet changed to "Create a wallet"

bobinson commented 5 years ago

@farisshajahan

  1. I created a wallet
  2. then invoked the command again
test@bkb-dev-server1:~/python-peerplays$ python3 cli.py createwallet
Wallet Passphrase:
Repeat for confirmation:
test@bkb-dev-server1:~/python-peerplays$

If I provide the same password again, its proceeding without complaining or showing that there is already a wallet.

Ideally it should check whether the wallet is existing or show a proper error message or informational message

farisshajahan commented 5 years ago

@bobinson

Wallet Passphrase: 
Repeat for confirmation: 
Traceback (most recent call last):
  File "cli.py", line 5, in <module>
    cli.main()
  File "/home/faris/venv/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/faris/venv/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/faris/venv/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/faris/venv/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/faris/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/faris/venv/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/faris/venv/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/faris/venv/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/faris/python-peerplays/peerplays/cli/decorators.py", line 49, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/faris/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/faris/python-peerplays/peerplays/cli/decorators.py", line 66, in new_func
    return ctx.invoke(f, *args, **kwargs)
  File "/home/faris/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/faris/python-peerplays/peerplays/cli/wallet.py", line 21, in createwallet
    ctx.peerplays.wallet.create(password)
  File "/home/faris/venv/lib/python3.6/site-packages/graphenecommon/wallet.py", line 145, in create
    self.newWallet(pwd)
  File "/home/faris/venv/lib/python3.6/site-packages/graphenecommon/wallet.py", line 151, in newWallet
    raise WalletExists("You already have created a wallet!")
graphenecommon.exceptions.WalletExists: You already have created a wallet!

This is what I get when I try to createwallet while having an existing wallet

bobinson commented 5 years ago

@farisshajahan - how did you run the command ?

farisshajahan commented 5 years ago

@bobinson Tried it two ways, one with python cli.py createwallet and another with peerplays createwallet. I got the same result as above in both cases.

bobinson commented 4 years ago

@farisshajahan - which is the Python version that you have ?

I am getting a different behavior with Python 3.6.7

root@bkb-dev-server1:/home/test/python-peerplays# python --version
Python 3.6.7

peerplays createwallet

root@bkb-dev-server1:/home/test/python-peerplays# /root/.pyenv/shims/peerplays createwallet
Wallet Passphrase:
Repeat for confirmation:
root@bkb-dev-server1:/home/test/python-peerplays# /root/.pyenv/shims/peerplays createwallet
Wallet Passphrase:
Repeat for confirmation:
root@bkb-dev-server1:/home/test/python-peerplays#

python cli.py createwallet


root@bkb-dev-server1:/home/test/python-peerplays# python cli.py createwallet
Wallet Passphrase:
Repeat for confirmation:
root@bkb-dev-server1:/home/test/python-peerplays#
root@bkb-dev-server1:/home/test/python-peerplays#
root@bkb-dev-server1:/home/test/python-peerplays# python cli.py createwallet
Wallet Passphrase:
Repeat for confirmation:
root@bkb-dev-server1:/home/test/python-peerplays#

/root/.pyenv/shims/peerplays createwallet

root@bkb-dev-server1:/home/test/python-peerplays# peerplays createwallet
Wallet Passphrase:
Repeat for confirmation:
root@bkb-dev-server1:/home/test/python-peerplays#
root@bkb-dev-server1:/home/test/python-peerplays#
root@bkb-dev-server1:/home/test/python-peerplays# peerplays createwallet
Wallet Passphrase:
Repeat for confirmation:
root@bkb-dev-server1:/home/test/python-peerplays#
farisshajahan commented 4 years ago

@bobinson I'm running the same version 3.6.7 as well

farisshajahan commented 4 years ago

@bobinson Is it possible that a wallet wasn't created in your case?

bobinson commented 4 years ago

looks like the file is not getting accessed the second time:

root@bkb-dev-server1:/home/test/python-peerplays# stat /root/.local/share/peerplays/peerplays.sqlite File: '/root/.local/share/peerplays/peerplays.sqlite' Size: 4096 Blocks: 8 IO Block: 4096 regular file Device: fc00h/64512d Inode: 8521698 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-07-19 08:12:12.551755979 -0300 Modify: 2019-07-19 08:11:46.499850624 -0300 Change: 2019-07-19 08:11:46.499850624 -0300 Birth: - root@bkb-dev-server1:/home/test/python-peerplays# peerplays createwallet Wallet Passphrase: Repeat for confirmation: root@bkb-dev-server1:/home/test/python-peerplays# stat /root/.local/share/peerplays/peerplays.sqlite File: '/root/.local/share/peerplays/peerplays.sqlite' Size: 4096 Blocks: 8 IO Block: 4096 regular file Device: fc00h/64512d Inode: 8521698 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-07-19 08:12:12.551755979 -0300 Modify: 2019-07-19 08:11:46.499850624 -0300 Change: 2019-07-19 08:11:46.499850624 -0300 Birth: - root@bkb-dev-server1:/home/test/python-peerplays#

bobinson commented 4 years ago

@farisshajahan - are you running with virtualenv ?

bobinson commented 4 years ago

This particular fix itself works. There is difference in behavior of the createwallet feature between virtualenv and pyenv + pip based environments. That has to be addressed elsewhere.

RoshanSyed commented 4 years ago

Looks good.