trestore default labels - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit bd309cff49370874a85dc4437e3f515266677275 DIR parent c2accd64cfb83836de52b9b7eb100d608dc61a98 HTML Author: ThomasV <thomasv@electrum.org> Date: Mon, 4 Jan 2016 15:40:57 +0100 restore default labels Diffstat: M lib/wallet.py | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -880,8 +880,21 @@ class Abstract_Wallet(PrintError): def get_label(self, tx_hash): label = self.labels.get(tx_hash, '') + if label is '': + label = self.get_default_label(tx_hash) return label + def get_default_label(self, tx_hash): + if self.txi.get(tx_hash) == {}: + d = self.txo.get(tx_hash, {}) + labels = [] + for addr in d.keys(): + label = self.labels.get(addr) + if label: + labels.append(label) + return ', '.join(labels) + return '' + def fee_per_kb(self, config): b = config.get('dynamic_fees') f = config.get('fee_factor', 50)