URI: 
       twallet: fix offline hw wallet signing when not specifying --offline - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit a10dc04b282ef598ccab9bb004e79584d7b57b5e
   DIR parent 84ca7ef3060cc00e87fb41a18038d66c008a5624
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Mon, 29 Jul 2019 13:27:37 +0200
       
       wallet: fix offline hw wallet signing when not specifying --offline
       
       closes #5532
       
       Diffstat:
         M electrum/interface.py               |       7 +++++--
         M electrum/network.py                 |       9 +++++----
         M electrum/wallet.py                  |      15 ++++++++-------
       
       3 files changed, 18 insertions(+), 13 deletions(-)
       ---
   DIR diff --git a/electrum/interface.py b/electrum/interface.py
       t@@ -157,7 +157,10 @@ class NotificationSession(RPCSession):
                    self.interface.logger.debug(msg)
        
        
       -class GracefulDisconnect(Exception):
       +class NetworkException(Exception): pass
       +
       +
       +class GracefulDisconnect(NetworkException):
            log_level = logging.INFO
        
            def __init__(self, *args, log_level=None, **kwargs):
       t@@ -173,7 +176,7 @@ class RequestTimedOut(GracefulDisconnect):
        
        class ErrorParsingSSLCert(Exception): pass
        class ErrorGettingSSLCertFromServer(Exception): pass
       -class ConnectError(Exception): pass
       +class ConnectError(NetworkException): pass
        
        
        class _RSClient(RSClient):
   DIR diff --git a/electrum/network.py b/electrum/network.py
       t@@ -52,7 +52,8 @@ from . import blockchain
        from . import bitcoin
        from .blockchain import Blockchain, HEADER_SIZE
        from .interface import (Interface, serialize_server, deserialize_server,
       -                        RequestTimedOut, NetworkTimeout, BUCKET_NAME_OF_ONION_SERVERS)
       +                        RequestTimedOut, NetworkTimeout, BUCKET_NAME_OF_ONION_SERVERS,
       +                        NetworkException)
        from .version import PROTOCOL_VERSION
        from .simple_config import SimpleConfig
        from .i18n import _
       t@@ -174,10 +175,10 @@ def deserialize_proxy(s: str) -> Optional[dict]:
            return proxy
        
        
       -class BestEffortRequestFailed(Exception): pass
       +class BestEffortRequestFailed(NetworkException): pass
        
        
       -class TxBroadcastError(Exception):
       +class TxBroadcastError(NetworkException):
            def get_message_for_gui(self):
                raise NotImplementedError()
        
       t@@ -205,7 +206,7 @@ class TxBroadcastUnknownError(TxBroadcastError):
                            _("Consider trying to connect to a different server, or updating Electrum."))
        
        
       -class UntrustedServerReturnedError(Exception):
       +class UntrustedServerReturnedError(NetworkException):
            def __init__(self, *, original_exception):
                self.original_exception = original_exception
        
   DIR diff --git a/electrum/wallet.py b/electrum/wallet.py
       t@@ -61,7 +61,7 @@ from .address_synchronizer import (AddressSynchronizer, TX_HEIGHT_LOCAL,
        from .paymentrequest import (PR_PAID, PR_UNPAID, PR_UNKNOWN, PR_EXPIRED,
                                     InvoiceStore)
        from .contacts import Contacts
       -from .interface import RequestTimedOut
       +from .interface import NetworkException
        from .ecc_fast import is_using_fast_ecc
        from .mnemonic import Mnemonic
        from .logging import get_logger
       t@@ -1060,7 +1060,7 @@ class Abstract_Wallet(AddressSynchronizer):
                        return True
                return False
        
       -    def get_input_tx(self, tx_hash, ignore_timeout=False):
       +    def get_input_tx(self, tx_hash, *, ignore_network_issues=False):
                # First look up an input transaction in the wallet where it
                # will likely be.  If co-signing a transaction it may not have
                # all the input txs, in which case we ask the network.
       t@@ -1069,9 +1069,10 @@ class Abstract_Wallet(AddressSynchronizer):
                    try:
                        raw_tx = self.network.run_from_another_thread(
                            self.network.get_transaction(tx_hash, timeout=10))
       -            except RequestTimedOut as e:
       -                self.logger.info(f'getting input txn from network timed out for {tx_hash}')
       -                if not ignore_timeout:
       +            except NetworkException as e:
       +                self.logger.info(f'got network error getting input txn. err: {repr(e)}. txid: {tx_hash}. '
       +                                 f'if you are intentionally offline, consider using the --offline flag')
       +                if not ignore_network_issues:
                            raise e
                    else:
                        tx = Transaction(raw_tx)
       t@@ -1082,8 +1083,8 @@ class Abstract_Wallet(AddressSynchronizer):
                for txin in tx.inputs():
                    tx_hash = txin['prevout_hash']
                    # segwit inputs might not be needed for some hw wallets
       -            ignore_timeout = Transaction.is_segwit_input(txin)
       -            txin['prev_tx'] = self.get_input_tx(tx_hash, ignore_timeout)
       +            ignore_network_issues = Transaction.is_segwit_input(txin)
       +            txin['prev_tx'] = self.get_input_tx(tx_hash, ignore_network_issues=ignore_network_issues)
                # add output info for hw wallets
                info = {}
                xpubs = self.get_master_public_keys()