From 9c471444188f46a1856d98de83897665ade66668 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 5 May 2023 16:06:16 +0000 Subject: [PATCH] qt: handle expected errors in DSCancelDialog closes https://github.com/spesmilo/electrum/issues/8390 --- electrum/gui/qt/rbf_dialog.py | 4 ++-- electrum/wallet.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qt/rbf_dialog.py b/electrum/gui/qt/rbf_dialog.py index 97c34cabc..346e473b2 100644 --- a/electrum/gui/qt/rbf_dialog.py +++ b/electrum/gui/qt/rbf_dialog.py @@ -15,7 +15,7 @@ from .util import (ColorScheme, WindowModalDialog, Buttons, from electrum.i18n import _ from electrum.transaction import PartialTransaction -from electrum.wallet import CannotBumpFee +from electrum.wallet import CannotRBFTx if TYPE_CHECKING: from .main_window import ElectrumWindow @@ -124,7 +124,7 @@ class _BaseRBFDialog(TxEditor): else: try: self.tx = self.make_tx(fee_rate) - except CannotBumpFee as e: + except CannotRBFTx as e: self.tx = None self.error = str(e) diff --git a/electrum/wallet.py b/electrum/wallet.py index b1db5f61e..7e4555f31 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -225,12 +225,14 @@ def get_locktime_for_new_transaction(network: 'Network') -> int: return locktime +class CannotRBFTx(Exception): pass -class CannotBumpFee(Exception): + +class CannotBumpFee(CannotRBFTx): def __str__(self): return _('Cannot bump fee') + ':\n\n' + Exception.__str__(self) -class CannotDoubleSpendTx(Exception): +class CannotDoubleSpendTx(CannotRBFTx): def __str__(self): return _('Cannot cancel transaction') + ':\n\n' + Exception.__str__(self)