electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 6d270364c66786a3be1d8a783db254f448ef054d
parent 5cfafff55d16cef64a1487c6b3ad6b6eadcd6ac7
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat, 18 Jan 2020 04:12:45 +0100

qt paytoedit: properly handle multiple max ('!') outputs

Diffstat:
Melectrum/gui/qt/main_window.py | 4++--
Melectrum/util.py | 5+++++
Melectrum/wallet.py | 4++--
3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -61,7 +61,7 @@ from electrum.util import (format_time, format_satoshis, format_fee_satoshis, UnknownBaseUnit, DECIMAL_POINT_DEFAULT, UserFacingException, get_new_wallet_name, send_exception_to_crash_reporter, InvalidBitcoinURI, maybe_extract_bolt11_invoice, NotEnoughFunds, - NoDynamicFeeEstimates) + NoDynamicFeeEstimates, MultipleSpendMaxTxOutputs) from electrum.util import PR_TYPE_ONCHAIN, PR_TYPE_LN from electrum.transaction import (Transaction, PartialTxInput, PartialTransaction, PartialTxOutput) @@ -1317,7 +1317,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): try: tx = make_tx(None) - except (NotEnoughFunds, NoDynamicFeeEstimates) as e: + except (NotEnoughFunds, NoDynamicFeeEstimates, MultipleSpendMaxTxOutputs) as e: self.max_button.setChecked(False) self.show_error(str(e)) return diff --git a/electrum/util.py b/electrum/util.py @@ -155,6 +155,11 @@ class NoDynamicFeeEstimates(Exception): return _('Dynamic fee estimates not available') +class MultipleSpendMaxTxOutputs(Exception): + def __str__(self): + return _('At most one output can be set to spend max') + + class InvalidPassword(Exception): def __str__(self): return _("Incorrect password") diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -48,7 +48,7 @@ from .bip32 import BIP32Node from .crypto import sha256 from .util import (NotEnoughFunds, UserCancelled, profiler, format_satoshis, format_fee_satoshis, NoDynamicFeeEstimates, - WalletFileException, BitcoinException, + WalletFileException, BitcoinException, MultipleSpendMaxTxOutputs, InvalidPassword, format_time, timestamp_to_datetime, Satoshis, Fiat, bfh, bh2u, TxMinedInfo, quantize_feerate, create_bip21_uri, OrderedDictWithIndex) from .util import PR_TYPE_ONCHAIN, PR_TYPE_LN @@ -993,7 +993,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): for i, o in enumerate(outputs): if o.value == '!': if i_max is not None: - raise Exception("More than one output set to spend max") + raise MultipleSpendMaxTxOutputs() i_max = i if fee is None and self.config.fee_per_kb() is None: