URI: 
       trestore from master public key with seed v4 - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 536c898b59c6c13c0014ab1d2a151856af2d7e51
   DIR parent c2f2ec2a8c2eed7a3f848f77e8cb5cb3fa2a6bc8
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Sun,  3 Nov 2013 14:14:35 +0100
       
       restore from master public key with seed v4
       
       Diffstat:
         M electrum                            |      10 ++++------
         M gui/qt/installwizard.py             |      10 +++++-----
         M lib/commands.py                     |       4 ++++
         M lib/wallet.py                       |      17 +++++++++++++----
       
       4 files changed, 26 insertions(+), 15 deletions(-)
       ---
   DIR diff --git a/electrum b/electrum
       t@@ -365,15 +365,13 @@ if __name__ == '__main__':
        
            elif cmd.name == 'getconfig':
                key = args[1]
       -        print_msg(config.get(key))
       +        out = config.get(key)
       +        print_msg(out)
        
            elif cmd.name == 'setconfig':
                key, value = args[1:3]
       -        if key not in ['seed', 'seed_version', 'master_public_key', 'use_encryption']:
       -            config.set_key(key, value, True)
       -            print_msg(True)
       -        else:
       -            print_msg(False)
       +        config.set_key(key, value, True)
       +        print_msg(True)
        
            elif cmd.name == 'password':
                new_password = prompt_password('New password:')
   DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py
       t@@ -166,10 +166,10 @@ class InstallWizard(QDialog):
                grid.addWidget(mpk_e, 0, 1)
        
                label = QLabel(_("Chain")) 
       -        grid.addWidget(label, 1, 0)
       +        #grid.addWidget(label, 1, 0)
                chain_e = QTextEdit()
                chain_e.setMaximumHeight(100)
       -        grid.addWidget(chain_e, 1, 1)
       +        #grid.addWidget(chain_e, 1, 1)
        
                vbox.addLayout(grid)
        
       t@@ -294,11 +294,11 @@ class InstallWizard(QDialog):
        
                elif action == 'watching':
                    # ask for seed and gap.
       -            K, chain = self.mpk_dialog()
       -            if not K or not chain:
       +            mpk = self.mpk_dialog()
       +            if not mpk:
                        return
                    wallet.seed = ''
       -            wallet.create_watching_only_wallet(chain,K)
       +            wallet.create_watching_only_wallet(mpk)
        
        
                else: raise
   DIR diff --git a/lib/commands.py b/lib/commands.py
       t@@ -74,6 +74,7 @@ register_command('getconfig',            1, 1, False, False, False, 'Return a co
        register_command('getpubkeys',           1, 1, False, True,  False, 'Return the public keys for a wallet address', 'getpubkeys <bitcoin address>')
        register_command('getrawtransaction',    1, 2, True,  False, False, 'Retrieve a transaction', 'getrawtransaction <txhash> <height>')
        register_command('getseed',              0, 0, False, True,  True,  'Print the generation seed of your wallet.')
       +register_command('getmpk',               0, 0, False, True,  False, 'Return your wallet\'s master public key', 'getmpk')
        register_command('help',                 0, 1, False, False, False, 'Prints this help')
        register_command('history',              0, 0, True,  True,  False, 'Returns the transaction history of your wallet')
        register_command('importprivkey',        1, 1, False, True,  True,  'Import a private key', 'importprivkey <privatekey>')
       t@@ -214,6 +215,9 @@ class Commands:
            def getservers(self):
                return self.network.get_servers()
        
       +    def getmpk(self):
       +        return self.wallet.get_master_public_key()
       +
            def getseed(self):
                mnemonic = self.wallet.get_mnemonic(self.password)
                seed = self.wallet.get_seed(self.password)
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -339,7 +339,16 @@ class Wallet:
                self.storage.put('seed', self.seed, True)
                self.storage.put('seed_version', self.seed_version, True)
        
       -    def create_watching_only_wallet(self, c0, K0):
       +    def create_watching_only_wallet(self, params):
       +        K0, c0 = params
       +        if not K0:
       +            return
       +
       +        if not c0:
       +            self.seed_version = 4
       +            self.create_old_account(K0)
       +            return
       +
                cK0 = ""
                self.master_public_keys = {
                    "m/0'/": (c0, K0, cK0),
       t@@ -350,7 +359,8 @@ class Wallet:
        
            def create_accounts(self): 
                if self.seed_version == 4:
       -            self.create_old_account()
       +            mpk = OldAccount.mpk_from_seed(self.seed)
       +            self.create_old_account(mpk)
                else:
                    # create default account
                    self.create_master_keys('1')
       t@@ -513,8 +523,7 @@ class Wallet:
                    self.set_label(k, name)
        
        
       -    def create_old_account(self):
       -        mpk = OldAccount.mpk_from_seed(self.seed)
       +    def create_old_account(self, mpk):
                self.storage.put('master_public_key', mpk, True)
                self.accounts[0] = OldAccount({'mpk':mpk, 0:[], 1:[]})
                self.save_accounts()