tAdd missing encryption in private key import (issue #1966). Allow key overwrite in order to fix affected wallets - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit f4d5efbf3b09d9798fbdd05a6d57ec8b8a1ab076 DIR parent c4c2203caafe01906edff10b88920d9dab91bf2e HTML Author: ThomasV <thomasv@electrum.org> Date: Wed, 12 Oct 2016 09:31:58 +0200 Add missing encryption in private key import (issue #1966). Allow key overwrite in order to fix affected wallets Diffstat: M lib/keystore.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- DIR diff --git a/lib/keystore.py b/lib/keystore.py t@@ -141,15 +141,12 @@ class Imported_KeyStore(Software_KeyStore): self.get_private_key((0,0), password) def import_key(self, sec, password): - if not self.can_import(): - raise BaseException('This wallet cannot import private keys') try: pubkey = public_key_from_private_key(sec) except Exception: raise BaseException('Invalid private key') - if pubkey in self.keypairs: - raise BaseException('Private key already in keystore') - self.keypairs[pubkey] = sec + # allow overwrite + self.keypairs[pubkey] = pw_encode(sec, password) self.receiving_pubkeys = self.keypairs.keys() return pubkey