electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit a70970ca20c7e235069992623eeb1e1dc3edbffa
parent 358068a0c1474b250eeceb1d9287099d80678121
Author: ThomasV <thomasv@electrum.org>
Date:   Fri,  3 Nov 2017 16:53:10 +0100

Merge pull request #3205 from SomberNight/delete_address_proper

proper address deletion for imported wallets
Diffstat:
Mlib/wallet.py | 30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -1468,12 +1468,42 @@ class Imported_Wallet(Simple_Wallet): def delete_address(self, address): if address not in self.addresses: return + + transactions_to_remove = set() # only referred to by this address + transactions_new = set() # txs that are not only referred to by address + with self.lock: + for addr, details in self.history.items(): + if addr == address: + for tx_hash, height in details: + transactions_to_remove.add(tx_hash) + else: + for tx_hash, height in details: + transactions_new.add(tx_hash) + transactions_to_remove -= transactions_new + self.history.pop(address, None) + + for tx_hash in transactions_to_remove: + self.remove_transaction(tx_hash) + self.tx_fees.pop(tx_hash, None) + self.verified_tx.pop(tx_hash, None) + self.unverified_tx.pop(tx_hash, None) + self.transactions.pop(tx_hash, None) + # FIXME: what about pruned_txo? + + self.storage.put('verified_tx3', self.verified_tx) + self.save_transactions() + + self.set_label(address, None) + self.remove_payment_request(address, {}) + self.set_frozen_state([address], False) + pubkey = self.get_public_key(address) self.addresses.pop(address) if pubkey: self.keystore.delete_imported_key(pubkey) self.save_keystore() self.storage.put('addresses', self.addresses) + self.storage.write() def get_address_index(self, address):