getprivatekeys shouldn't raise an exception if no such key is in the wallet, just print an error message
Open
Nobody has claimed this yet.
enhancement ✨
priority-low 🧊
- Dominant language
- Python
- Stars
- 8.6k
- Forks
- 3.5k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 61
Description
This should just print "no such key in wallet" and return 1 to the
shell, not raise an exception.
$ ./electrum-ltc -w $@ --testnet getprivatekeys mw9ABC123_some_not_in_wallet_key
WARNING: ALL your private keys are secret.
Exposing a single private key can compromise your entire wallet!
In particular, DO NOT use 'redeem private key' services proposed by third parties.
Traceback (most recent call last):
File "./electrum-ltc", line 427, in <module>
result = run_offline_command(config, config_options)
File "./electrum-ltc", line 288, in run_offline_command
result = func(*args, **kwargs)
File "/home/jidanni/com/github/pooler/electrum-ltc-master/lib/commands.py", line 87, in func_wrapper
return func(*args, **kwargs)
File "/home/jidanni/com/github/pooler/electrum-ltc-master/lib/commands.py", line 281, in getprivatekeys
return [self.wallet.export_private_key(address, password)[0] for address in domain]
File "/home/jidanni/com/github/pooler/electrum-ltc-master/lib/commands.py", line 281, in <listcomp>
return [self.wallet.export_private_key(address, password)[0] for address in domain]
File "/home/jidanni/com/github/pooler/electrum-ltc-master/lib/wallet.py", line 353, in export_private_key
index = self.get_address_index(address)
File "/home/jidanni/com/github/pooler/electrum-ltc-master/lib/wallet.py", line 347, in get_address_index
raise Exception("Address not found", address)
Exception: ('Address not found', 'm')
Please see https://github.com/pooler/electrum-ltc/issues/122 .
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with getprivatekeys in lib/commands.py and follow its call to export_private_key and get_address_index in lib/wallet.py. Reproduce the shown electrum-ltc command with an address absent from the wallet. Done means it prints "no such key in wallet" instead of a traceback and returns status 1 to the shell.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100