qml: show warning in ConfirmTxDialog if max amount cannot be fully sent due to channel reserve requirements.
This commit is contained in:
committed by
ThomasV
parent
001a1152fd
commit
3fd64b60ab
@@ -14,7 +14,9 @@ TextHighlightPane {
|
|||||||
property int idx: -1
|
property int idx: -1
|
||||||
|
|
||||||
property string _suffix: model.is_mine || model.is_change
|
property string _suffix: model.is_mine || model.is_change
|
||||||
? qsTr('mine')
|
? model.is_reserve
|
||||||
|
? qsTr('reserve')
|
||||||
|
: qsTr('mine')
|
||||||
: model.is_swap
|
: model.is_swap
|
||||||
? qsTr('swap')
|
? qsTr('swap')
|
||||||
: model.is_billing
|
: model.is_billing
|
||||||
|
|||||||
@@ -275,7 +275,8 @@ class TxFeeSlider(FeeSlider):
|
|||||||
'is_mine': self._wallet.wallet.is_mine(o.get_ui_address_str()),
|
'is_mine': self._wallet.wallet.is_mine(o.get_ui_address_str()),
|
||||||
'is_change': self._wallet.wallet.is_change(o.get_ui_address_str()),
|
'is_change': self._wallet.wallet.is_change(o.get_ui_address_str()),
|
||||||
'is_billing': self._wallet.wallet.is_billing_address(o.get_ui_address_str()),
|
'is_billing': self._wallet.wallet.is_billing_address(o.get_ui_address_str()),
|
||||||
'is_swap': False if not sm else sm.is_lockup_address_for_a_swap(o.get_ui_address_str()) or o.get_ui_address_str() == DummyAddress.SWAP
|
'is_swap': False if not sm else sm.is_lockup_address_for_a_swap(o.get_ui_address_str()) or o.get_ui_address_str() == DummyAddress.SWAP,
|
||||||
|
'is_reserve': o.is_utxo_reserve
|
||||||
})
|
})
|
||||||
self.outputs = outputs
|
self.outputs = outputs
|
||||||
|
|
||||||
@@ -417,6 +418,15 @@ class QETxFinalizer(TxFeeSlider):
|
|||||||
|
|
||||||
self.update_fee_warning_from_tx(tx=tx, invoice_amt=amount)
|
self.update_fee_warning_from_tx(tx=tx, invoice_amt=amount)
|
||||||
|
|
||||||
|
if self._amount.isMax and not self.warning:
|
||||||
|
if reserve_sats := sum(txo.value for txo in tx.outputs() if txo.is_utxo_reserve):
|
||||||
|
reserve_str = self._config.format_amount_and_units(reserve_sats)
|
||||||
|
self.warning = ' '.join([
|
||||||
|
_('Warning') + ':',
|
||||||
|
_('Could not spend max: a security reserve of {} was kept for your Lightning channels.')
|
||||||
|
.format(reserve_str)
|
||||||
|
])
|
||||||
|
|
||||||
self._valid = True
|
self._valid = True
|
||||||
self.validChanged.emit()
|
self.validChanged.emit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user