URI: 
       tfix tx signing with watching only wallets - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 7ead6d18f253eba0f95fc3f6bd36f117aeac6d55
   DIR parent df76aac2db685dc569af68b44717bed4901b78bd
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Tue, 12 Nov 2013 11:14:16 +0100
       
       fix tx signing with watching only wallets
       
       Diffstat:
         M gui/qt/main_window.py               |      18 ++++++++++--------
         M gui/qt/transaction_dialog.py        |      11 ++++++++---
         M lib/transaction.py                  |       2 +-
         M lib/wallet.py                       |       3 +++
       
       4 files changed, 22 insertions(+), 12 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -910,14 +910,16 @@ class ElectrumWindow(QMainWindow):
                    else:
                        QMessageBox.warning(self, _('Error'), msg, _('OK'))
                else:
       -            filename = label + '.txn' if label else 'unsigned_%s.txn' % (time.mktime(time.gmtime()))
       -            try:
       -                fileName = self.getSaveFileName(_("Select a transaction filename"), filename, "*.txn")
       -                with open(fileName,'w') as f:
       -                    f.write(json.dumps(tx.as_dict(),indent=4) + '\n')
       -                QMessageBox.information(self, _('Unsigned transaction created'), _("Unsigned transaction was saved to file:") + " " +fileName, _('OK'))
       -            except Exception:
       -                QMessageBox.warning(self, _('Error'), _('Could not write transaction to file'), _('OK'))
       +
       +            self.show_transaction(tx)
       +            #filename = label + '.txn' if label else 'unsigned_%s.txn' % (time.mktime(time.gmtime()))
       +            #try:
       +            #    fileName = self.getSaveFileName(_("Select a transaction filename"), filename, "*.txn")
       +            #    with open(fileName,'w') as f:
       +            #        f.write(json.dumps(tx.as_dict(),indent=4) + '\n')
       +            #    QMessageBox.information(self, _('Unsigned transaction created'), _("Unsigned transaction was saved to file:") + " " +fileName, _('OK'))
       +            #except Exception:
       +            #    QMessageBox.warning(self, _('Error'), _('Could not write transaction to file'), _('OK'))
        
                # add recipient to addressbook
                if to_address not in self.wallet.addressbook and not self.wallet.is_mine(to_address):
   DIR diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py
       t@@ -106,7 +106,8 @@ class TxDialog(QDialog):
        
        
            def save(self):
       -        fileName = self.parent.getSaveFileName(_("Select where to save your signed transaction"), 'signed_%s.txn' % (self.tx.hash()[0:8]), "*.txn")
       +        name = 'signed_%s.txn' % (self.tx.hash()[0:8]) if self.tx.is_complete else 'unsigned.txn'
       +        fileName = self.parent.getSaveFileName(_("Select where to save your signed transaction"), name, "*.txn")
                if fileName:
                    with open(fileName, "w+") as f:
                        f.write(json.dumps(self.tx.as_dict(),indent=4) + '\n')
       t@@ -115,13 +116,13 @@ class TxDialog(QDialog):
        
        
            def update(self):
       -        tx_hash = self.tx.hash()
        
                is_relevant, is_mine, v, fee = self.wallet.get_tx_value(self.tx)
        
                if self.tx.is_complete:
                    status = _("Status: Signed")
                    self.sign_button.hide()
       +            tx_hash = self.tx.hash()
        
                    if tx_hash in self.wallet.transactions.keys():
                        conf, timestamp = self.wallet.verifier.get_confirmations(tx_hash)
       t@@ -138,8 +139,12 @@ class TxDialog(QDialog):
                else:
                    status = _("Status: Unsigned")
                    time_str = None
       -            self.sign_button.show()
       +            if not self.wallet.is_watching_only():
       +                self.sign_button.show()
       +            else:
       +                self.sign_button.hide()
                    self.broadcast_button.hide()
       +            tx_hash = 'unknown'
        
                self.tx_hash_e.setText(tx_hash)
                self.status_label.setText(status)
   DIR diff --git a/lib/transaction.py b/lib/transaction.py
       t@@ -677,7 +677,7 @@ class Transaction:
                        'redeemScript':i.get('redeemScript'),
                        'redeemPubkey':i.get('redeemPubkey'),
                        'pubkeys':i.get('pubkeys'),
       -                'signatures':i.get('signatures'),
       +                'signatures':i.get('signatures',[]),
                        }
                    info.append(item)
                return info
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -699,6 +699,9 @@ class Wallet:
                
        
            def get_private_key(self, address, password):
       +        if self.is_watching_only():
       +            return []
       +
                # first check the provided password
                seed = self.get_seed(password)