URI: 
       tfix #2353: show error when sweeping dust - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 50587c7a24fe5df6c368dda94f920748e01eed02
   DIR parent b8e2c67b546835f20e890fa9ca2e02aebac8202a
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Wed,  5 Apr 2017 09:17:42 +0200
       
       fix #2353: show error when sweeping dust
       
       Diffstat:
         M gui/qt/main_window.py               |       7 ++++---
         M lib/wallet.py                       |       8 +++++++-
       
       2 files changed, 11 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -2306,9 +2306,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                if not d.exec_():
                    return
        
       -        tx = self.wallet.sweep(get_pk(), self.network, self.config, get_address(), None)
       -        if not tx:
       -            self.show_message(_('No inputs found. (Note that inputs need to be confirmed)'))
       +        try:
       +            tx = self.wallet.sweep(get_pk(), self.network, self.config, get_address(), None)
       +        except BaseException as e:
       +            self.show_message(str(e))
                    return
                self.warn_if_watching_only()
                self.show_transaction(tx)
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -892,7 +892,7 @@ class Abstract_Wallet(PrintError):
                    keypairs[pubkey] = privkey
        
                if not inputs:
       -            return
       +            raise BaseException(_('No inputs found. (Note that inputs need to be confirmed)'))
        
                total = sum(i.get('value') for i in inputs)
                if fee is None:
       t@@ -900,6 +900,12 @@ class Abstract_Wallet(PrintError):
                    tx = Transaction.from_io(inputs, outputs)
                    fee = self.estimate_fee(config, tx.estimated_size())
        
       +        if total - fee < 0:
       +            raise BaseException(_('Not enough funds on address.') + '\nTotal: %d satoshis\nFee: %d\nDust Threshold: %d'%(total, fee))
       +
       +        if total - fee < self.dust_threshold():
       +            raise BaseException(_('Not enough funds on address.') + '\nTotal: %d satoshis\nFee: %d\nDust Threshold: %d'%(total, fee, self.dust_threshold()))
       +
                outputs = [(TYPE_ADDRESS, recipient, total - fee)]
                tx = Transaction.from_io(inputs, outputs)
                tx.sign(keypairs)