tadd prioritize and freeze console commands. fix choose_inputs - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit e1b3b5892b79f4a06a2f0efb8c3016763b27ebd6 DIR parent 4e876fcfcfbf8ba4aba08a86112530d4dbd38c4d HTML Author: ThomasV <thomasv@gitorious> Date: Wed, 6 Jun 2012 19:26:05 +0200 add prioritize and freeze console commands. fix choose_inputs Diffstat: M electrum | 68 +++++++++++++++++++++++++++++-- M lib/gui_qt.py | 4 ++-- M lib/wallet.py | 2 +- 3 files changed, 68 insertions(+), 6 deletions(-) --- DIR diff --git a/electrum b/electrum t@@ -39,8 +39,35 @@ from optparse import OptionParser from decimal import Decimal from electrum import Wallet, WalletSynchronizer, format_satoshis -known_commands = ['help', 'validateaddress', 'balance', 'contacts', 'create', 'restore', 'payto', 'sendtx', 'password', 'addresses', 'history', 'label', 'mktx','seed','import','signmessage','verifymessage','eval','deseed','reseed'] -offline_commands = ['password', 'mktx', 'label', 'contacts', 'help', 'validateaddress', 'signmessage', 'verifymessage', 'eval', 'create', 'addresses', 'import', 'seed','deseed','reseed'] +known_commands = [ + 'help', + 'validateaddress', + 'balance', + 'contacts', + 'create', + 'restore', + 'payto', + 'sendtx', + 'password', + 'addresses', + 'history', + 'label', + 'mktx', + 'seed', + 'import', + 'signmessage', + 'verifymessage', + 'eval', + 'deseed', + 'reseed', + 'freeze', + 'unfreeze', + 'prioritize', + 'unprioritize', + ] + +offline_commands = [ 'password', 'mktx', 'label', 'contacts', 'help', 'validateaddress', 'signmessage', 'verifymessage', 'eval', 'create', 'addresses', 'import', 'seed','deseed','reseed','freeze','unfreeze','prioritize','unprioritize'] + protected_commands = ['payto', 'password', 'mktx', 'seed', 'import','signmessage' ] if __name__ == '__main__': t@@ -480,5 +507,40 @@ if __name__ == '__main__': print True except: print False - + + elif cmd == 'freeze': + addr = args[1] + if addr in self.wallet.all_addresses() and addr not in self.wallet.frozen_addresses: + self.wallet.frozen_addresses.append(addr) + self.wallet.save() + print True + else: + print False + + elif cmd == 'unfreeze': + addr = args[1] + if addr in self.wallet.all_addresses() and addr in self.wallet.frozen_addresses: + self.wallet.frozen_addresses.remove(addr) + self.wallet.save() + print True + else: + print False + + elif cmd == 'prioritize': + addr = args[1] + if addr in self.wallet.all_addresses() and addr not in self.wallet.frozen_addresses: + self.wallet.prioritized_addresses.append(addr) + self.wallet.save() + print True + else: + print False + + elif cmd == 'unprioritize': + addr = args[1] + if addr in self.wallet.all_addresses() and addr in self.wallet.frozen_addresses: + self.wallet.prioritized_addresses.remove(addr) + self.wallet.save() + print True + else: + print False DIR diff --git a/lib/gui_qt.py b/lib/gui_qt.py t@@ -566,7 +566,7 @@ class ElectrumWindow(QMainWindow): self.wallet.save() self.update_receive_tab() - self.prioritizeButton = b = EnterButton(_("Set priority"), toggle_priority) + self.prioritizeButton = b = EnterButton(_("Prioritize"), toggle_priority) hbox.addWidget(b) hbox.addStretch(1) t@@ -592,7 +592,7 @@ class ElectrumWindow(QMainWindow): t = _("Unfreeze") if addr in self.wallet.frozen_addresses else _("Freeze") self.freezeButton.setText(t) - t = _("Remove priority") if addr in self.wallet.prioritized_addresses else _("Set priority") + t = _("Unprioritize") if addr in self.wallet.prioritized_addresses else _("Prioritize") self.prioritizeButton.setText(t) DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -669,7 +669,7 @@ class Wallet: coins = sorted( coins, key = lambda x: x[1]['timestamp'] ) - for addr in prioritized_addresses: + for addr in self.prioritized_addresses: h = self.history.get(addr) if h is None: continue for item in h: