diff --git a/electrum/gui/qml/components/RbfBumpFeeDialog.qml b/electrum/gui/qml/components/RbfBumpFeeDialog.qml index 9d2c514c1..4761da34c 100644 --- a/electrum/gui/qml/components/RbfBumpFeeDialog.qml +++ b/electrum/gui/qml/components/RbfBumpFeeDialog.qml @@ -44,12 +44,11 @@ ElDialog { columns: 2 - Label { + InfoTextArea { Layout.columnSpan: 2 Layout.fillWidth: true Layout.bottomMargin: constants.paddingLarge - text: qsTr('Increase your transaction\'s fee to improve its position in the mempool') - wrapMode: Text.Wrap + text: qsTr('Move the slider to increase your transaction\'s fee. This will improve its position in the mempool') } Label { @@ -186,12 +185,11 @@ ElDialog { } } - InfoTextArea { + Label { Layout.columnSpan: 2 Layout.fillWidth: true visible: rbffeebumper.warning != '' text: rbffeebumper.warning - iconStyle: InfoTextArea.IconStyle.Warn } Label { diff --git a/electrum/gui/qml/components/RbfCancelDialog.qml b/electrum/gui/qml/components/RbfCancelDialog.qml index 899c10dc1..3f4aaccb7 100644 --- a/electrum/gui/qml/components/RbfCancelDialog.qml +++ b/electrum/gui/qml/components/RbfCancelDialog.qml @@ -41,12 +41,11 @@ ElDialog { width: parent.width columns: 2 - Label { + InfoTextArea { Layout.columnSpan: 2 Layout.fillWidth: true Layout.bottomMargin: constants.paddingLarge - text: qsTr('Cancel an unconfirmed RBF transaction by double-spending its inputs back to your wallet with a higher fee.') - wrapMode: Text.Wrap + text: qsTr('Cancel an unconfirmed transaction by double-spending its inputs back to your wallet with a higher fee.') } Label { @@ -156,12 +155,11 @@ ElDialog { } } - InfoTextArea { + Label { Layout.columnSpan: 2 Layout.fillWidth: true visible: txcanceller.warning != '' text: txcanceller.warning - iconStyle: InfoTextArea.IconStyle.Warn } Label { diff --git a/electrum/gui/qml/components/TxDetails.qml b/electrum/gui/qml/components/TxDetails.qml index a9f8aeded..e942e83c8 100644 --- a/electrum/gui/qml/components/TxDetails.qml +++ b/electrum/gui/qml/components/TxDetails.qml @@ -47,7 +47,18 @@ Pane { Heading { Layout.columnSpan: 2 - text: qsTr('Transaction Details') + text: qsTr('On-chain Transaction') + } + + InfoTextArea { + id: bumpfeeinfo + Layout.columnSpan: 2 + Layout.fillWidth: true + Layout.bottomMargin: constants.paddingLarge + visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel + text: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel + ? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction') + : qsTr('You can bump its fee to speed up its confirmation')) } RowLayout { @@ -126,70 +137,6 @@ Pane { visible: txdetails.mempoolDepth } - TextHighlightPane { - Layout.fillWidth: true - Layout.topMargin: constants.paddingSmall - Layout.columnSpan: 2 - borderColor: constants.colorWarning - visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel - - GridLayout { - width: parent.width - columns: actionButtonsLayout.implicitWidth > parent.width/2 - ? 1 - : 2 - Label { - id: bumpfeeinfo - Layout.fillWidth: true - text: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel - ? qsTr('You can increase fees to speed up the transaction, or cancel this transaction') - : qsTr('You can increase fees to speed up the transaction')) - wrapMode: Text.Wrap - } - ColumnLayout { - id: actionButtonsLayout - Layout.alignment: Qt.AlignHCenter - Pane { - Layout.alignment: Qt.AlignHCenter - background: Rectangle { color: Material.dialogColor } - padding: 0 - visible: txdetails.canBump || txdetails.canCpfp - FlatButton { - id: feebumpButton - textUnderIcon: false - icon.source: '../../icons/add.png' - text: qsTr('Bump fee') - onClicked: { - if (txdetails.canBump) { - var dialog = rbfBumpFeeDialog.createObject(root, { txid: root.txid }) - } else { - var dialog = cpfpBumpFeeDialog.createObject(root, { txid: root.txid }) - } - dialog.open() - } - } - } - Pane { - Layout.alignment: Qt.AlignHCenter - background: Rectangle { color: Material.dialogColor } - padding: 0 - visible: txdetails.canCancel - FlatButton { - id: cancelButton - textUnderIcon: false - icon.source: '../../icons/closebutton.png' - text: qsTr('Cancel Tx') - onClicked: { - var dialog = rbfCancelDialog.createObject(root, { txid: root.txid }) - dialog.open() - } - } - } - } - } - - } - Label { visible: txdetails.isMined text: qsTr('Date') @@ -348,6 +295,34 @@ Pane { ButtonContainer { Layout.fillWidth: true + FlatButton { + Layout.fillWidth: true + Layout.preferredWidth: 1 + id: feebumpButton + icon.source: '../../icons/add.png' + text: qsTr('Bump fee') + visible: txdetails.canBump || txdetails.canCpfp + onClicked: { + if (txdetails.canBump) { + var dialog = rbfBumpFeeDialog.createObject(root, { txid: root.txid }) + } else { + var dialog = cpfpBumpFeeDialog.createObject(root, { txid: root.txid }) + } + dialog.open() + } + } + FlatButton { + Layout.fillWidth: true + Layout.preferredWidth: 1 + id: cancelButton + icon.source: '../../icons/closebutton.png' + text: qsTr('Cancel Tx') + visible: txdetails.canCancel + onClicked: { + var dialog = rbfCancelDialog.createObject(root, { txid: root.txid }) + dialog.open() + } + } FlatButton { Layout.fillWidth: true Layout.preferredWidth: 1 @@ -452,7 +427,6 @@ Pane { } function onBroadcastSucceeded() { bumpfeeinfo.text = qsTr('Transaction was broadcast successfully') - actionButtonsLayout.visible = false } } diff --git a/electrum/gui/qml/qetxfinalizer.py b/electrum/gui/qml/qetxfinalizer.py index 62b0d8493..6c6972a5f 100644 --- a/electrum/gui/qml/qetxfinalizer.py +++ b/electrum/gui/qml/qetxfinalizer.py @@ -527,7 +527,12 @@ class QETxRbfFeeBumper(TxFeeSlider, TxMonMixin): return new_fee_rate = fee_per_kb / 1000 - + if new_fee_rate <= float(self._oldfee_rate): + self._tx = None + self._valid = False + self.validChanged.emit() + self.warning = _("The new fee rate needs to be higher than the old fee rate.") + return try: self._tx = self._wallet.wallet.bump_fee( tx=self._orig_tx, @@ -630,6 +635,12 @@ class QETxCanceller(TxFeeSlider, TxMonMixin): return new_fee_rate = fee_per_kb / 1000 + if new_fee_rate <= float(self._oldfee_rate): + self._tx = None + self._valid = False + self.validChanged.emit() + self.warning = _("The new fee rate needs to be higher than the old fee rate.") + return try: self._tx = self._wallet.wallet.dscancel(