URI: 
       tallow address creation beyond gap limit in GUI. fixes #512 - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit b5acdab3e98f22ae212dd9aa091f00d3132c186f
   DIR parent 38f5deee867f11db5fc3c82ecf632eb449376b1f
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Thu, 26 Jun 2014 18:55:22 +0200
       
       allow address creation beyond gap limit in GUI. fixes #512
       
       Diffstat:
         M gui/qt/main_window.py               |      21 +++++++++++++++++++--
         M lib/wallet.py                       |      14 +++++++++++++-
       
       2 files changed, 32 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -40,6 +40,7 @@ from electrum import Transaction
        from electrum import mnemonic
        from electrum import util, bitcoin, commands, Interface, Wallet
        from electrum import SimpleConfig, Wallet, WalletStorage
       +from electrum import Imported_Wallet
        
        from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit
        from network_dialog import NetworkDialog
       t@@ -681,7 +682,7 @@ class ElectrumWindow(QMainWindow):
                self.save_request_button.clicked.connect(self.save_payment_request)
                grid.addWidget(self.save_request_button, 3, 1)
                clear_button = QPushButton(_('New'))
       -        clear_button.clicked.connect(self.clear_receive_tab)
       +        clear_button.clicked.connect(self.new_receive_address)
                grid.addWidget(clear_button, 3, 2)
                grid.setRowStretch(4, 1)
        
       t@@ -739,6 +740,22 @@ class ElectrumWindow(QMainWindow):
                self.wallet.storage.put('receive_requests', self.receive_requests)
                self.update_receive_tab()
        
       +    def new_receive_address(self):
       +        domain = self.wallet.get_account_addresses(self.current_account, include_change=False)
       +        for addr in domain:
       +            if not self.wallet.address_is_old(addr) and addr not in self.receive_requests.keys():
       +                break
       +        else:
       +            if isinstance(self.wallet, Imported_Wallet):
       +                self.show_message(_('No more addresses in your wallet.'))
       +                return
       +            if not self.question(_("Warning: The next address will not be recovered automatically if you restore your wallet from seed; you may need to add it manually.\n\nThis occurs because you have too many unused addresses in your wallet. To avoid this situation, use the existing addresses first.\n\nCreate anyway?")):
       +                return
       +            addr = self.wallet.create_new_address(self.current_account, False)
       +        self.receive_address_e.setText(addr)
       +        self.receive_message_e.setText('')
       +        self.receive_amount_e.setAmount(None)
       +
            def clear_receive_tab(self):
                self.receive_requests = self.wallet.storage.get('receive_requests',{}) 
                domain = self.wallet.get_account_addresses(self.current_account, include_change=False)
       t@@ -746,7 +763,7 @@ class ElectrumWindow(QMainWindow):
                    if not self.wallet.address_is_old(addr) and addr not in self.receive_requests.keys():
                        break
                else:
       -            addr = ""
       +            addr = ''
                self.receive_address_e.setText(addr)
                self.receive_message_e.setText('')
                self.receive_amount_e.setAmount(None)
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -547,7 +547,7 @@ class Abstract_Wallet:
        
            def get_account_addresses(self, a, include_change=True):
                if a is None:
       -            o = self.addresses(True)
       +            o = self.addresses(include_change)
                elif a in self.accounts:
                    ac = self.accounts[a]
                    o = ac.get_addresses(0)
       t@@ -1140,10 +1140,13 @@ class Deterministic_Wallet(Abstract_Wallet):
                return nmax + 1
        
            def create_new_address(self, account, for_change):
       +        if account is None:
       +            account = self.default_account()
                address = account.create_new_address(for_change)
                self.history[address] = []
                self.synchronizer.add(address)
                self.save_accounts()
       +        return address
        
            def synchronize_sequence(self, account, for_change):
                limit = self.gap_limit_for_change if for_change else self.gap_limit
       t@@ -1257,6 +1260,9 @@ class NewWallet(Deterministic_Wallet):
            def __init__(self, storage):
                Deterministic_Wallet.__init__(self, storage)
        
       +    def default_account(self):
       +        return self.accounts["m/0'"]
       +
            def is_watching_only(self):
                return self.master_private_keys is {}
        
       t@@ -1401,6 +1407,9 @@ class Wallet_2of2(NewWallet):
                NewWallet.__init__(self, storage)
                self.storage.put('wallet_type', '2of2', True)
        
       +    def default_account(self):
       +        return self.accounts['m/']
       +
            def can_create_accounts(self):
                return False
        
       t@@ -1462,6 +1471,9 @@ class Wallet_2of3(Wallet_2of2):
        
        class OldWallet(Deterministic_Wallet):
        
       +    def default_account(self):
       +        return self.accounts[0]
       +
            def make_seed(self):
                import mnemonic
                seed = random_seed(128)