1
0

Speed up freezing and unfreezing of many addresses

Speedup mainly from writing to storage only once.
Make frozen_addresses a set in memory, as sets give cleaner
code and are more efficient.

Minor change in behaviour: command line freezing used to return
False if the address isn't in the wallet OR the address was already
frozen.  Now it returns more like a success code: it returns False
only if the address isn't in the wallet regardless of frozen state.
Similarly for unfreezing.
This commit is contained in:
Neil Booth
2015-05-31 10:37:43 +09:00
parent d6f4b57d64
commit 0f29984f07
4 changed files with 18 additions and 31 deletions

View File

@@ -1079,10 +1079,7 @@ class ElectrumWindow:
path, col = treeview.get_cursor()
if path:
address = liststore.get_value( liststore.get_iter(path), 0)
if address in wallet.frozen_addresses:
wallet.unfreeze(address)
else:
wallet.freeze(address)
wallet.set_frozen_state([address], not wallet.is_frozen(address))
self.update_receiving_tab()
button.connect("clicked", freeze_address, treeview, liststore, self.wallet)
button.show()
@@ -1151,7 +1148,7 @@ class ElectrumWindow:
if address in self.wallet.imported_keys.keys():
Type = "I"
c, u, x = self.wallet.get_addr_balance(address)
if address in self.wallet.frozen_addresses: Type = Type + "F"
if self.wallet.is_frozen(address): Type = Type + "F"
label = self.wallet.labels.get(address)
h = self.wallet.history.get(address,[])
n = len(h)