theQRL / QRL

Quantum Resistant Ledger
https://theqrl.org/
MIT License
417 stars 109 forks source link

telnet: wallet command crashes #332

Closed randomshinichi closed 7 years ago

randomshinichi commented 7 years ago

Seems to be a new problem, never had this before git pulling today.

2017-10-07 15:34:22,511 |unsynced| CRITICAL : [TWISTED] Unhandled Error
Traceback (most recent call last):
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
Unhandled Error
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
Traceback (most recent call last):
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
    return func(*args,**kw)
    return callWithContext({"system": lp}, func, *args, **kw)
--- <exception caught here> ---
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/internet/selectreactor.py", line 149, in _doReadOrWrite
    return context.call({ILogContext: newCtx}, func, *args, **kw)
    why = getattr(selectable, method)()
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/internet/tcp.py", line 208, in doRead
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
    return self._dataReceived(data)
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/internet/tcp.py", line 214, in _dataReceived
    return func(*args,**kw)
    rval = self.protocol.dataReceived(data)
--- <exception caught here> ---
  File "/Users/shinichi/source/QRL/qrl/core/walletprotocol.py", line 97, in dataReceived
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/internet/selectreactor.py", line 149, in _doReadOrWrite
    if not self.parse_cmd(data):
    why = getattr(selectable, method)()
  File "/Users/shinichi/source/QRL/qrl/core/walletprotocol.py", line 78, in parse_cmd
    self.cmd_mapping[command](args)
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/internet/tcp.py", line 208, in doRead
  File "/Users/shinichi/source/QRL/qrl/core/walletprotocol.py", line 344, in _wallet
    return self._dataReceived(data)
    self.factory.state.state_read_chain(self.factory.chain)
  File "/Users/shinichi/.virtualenvs/qrl/lib/python3.6/site-packages/twisted/internet/tcp.py", line 214, in _dataReceived
  File "/Users/shinichi/source/QRL/qrl/core/state.py", line 485, in state_read_chain
    rval = self.protocol.dataReceived(data)
    self.zero_all_addresses()
  File "/Users/shinichi/source/QRL/qrl/core/walletprotocol.py", line 97, in dataReceived
  File "/Users/shinichi/source/QRL/qrl/core/state.py", line 229, in zero_all_addresses
    if not self.parse_cmd(data):
    self.db.put(address, [0, 0, []])
  File "/Users/shinichi/source/QRL/qrl/core/walletprotocol.py", line 78, in parse_cmd
  File "/Users/shinichi/source/QRL/qrl/core/db.py", line 37, in put
    self.cmd_mapping[command](args)
    key_obj = key_obj.encode()
  File "/Users/shinichi/source/QRL/qrl/core/walletprotocol.py", line 344, in _wallet
builtins.AttributeError: 'bytearray' object has no attribute 'encode'
    self.factory.state.state_read_chain(self.factory.chain)

  File "/Users/shinichi/source/QRL/qrl/core/state.py", line 485, in state_read_chain
    self.zero_all_addresses()
  File "/Users/shinichi/source/QRL/qrl/core/state.py", line 229, in zero_all_addresses
    self.db.put(address, [0, 0, []])
  File "/Users/shinichi/source/QRL/qrl/core/db.py", line 37, in put
    key_obj = key_obj.encode()
builtins.AttributeError: 'bytearray' object has no attribute 'encode'
jleni commented 7 years ago

It is fixed already. I can cherry-pick and push if this is blocking you.

randomshinichi commented 7 years ago

Yes, please do that.

jleni commented 7 years ago

The original problem was fixed by PR #334 A problem that appears later was fixed by PR #339