Browse Source

qml: always try to generate an address for request regardless of bolt11_fallback config.

patch-4
Sander van Grieken 2 years ago
parent
commit
ad04ca84d8
  1. 24
      electrum/gui/qml/components/WalletDetails.qml
  2. 3
      electrum/gui/qml/qewallet.py
  3. 3
      electrum/invoices.py

24
electrum/gui/qml/components/WalletDetails.qml

@ -13,6 +13,8 @@ Pane {
padding: 0
property bool _is2fa: Daemon.currentWallet && Daemon.currentWallet.walletType == '2fa'
function enableLightning() {
var dialog = app.messageDialog.createObject(rootItem,
{'text': qsTr('Enable Lightning for this wallet?'), 'yesno': true})
@ -168,32 +170,33 @@ Pane {
}
GridLayout {
visible: Daemon.currentWallet && Daemon.currentWallet.walletType == '2fa'
Layout.preferredWidth: parent.width
visible: Daemon.currentWallet
columns: 2
Label {
visible: _is2fa
text: qsTr('2FA')
color: Material.accentColor
}
Label {
Layout.fillWidth: true
visible: _is2fa
text: Daemon.currentWallet.canSignWithoutServer
? qsTr('disabled (can sign without server')
? qsTr('disabled (can sign without server)')
: qsTr('enabled')
}
Label {
visible: !Daemon.currentWallet.canSignWithoutServer
visible: _is2fa && !Daemon.currentWallet.canSignWithoutServer
text: qsTr('Remaining TX')
color: Material.accentColor
}
Label {
Layout.fillWidth: true
visible: !Daemon.currentWallet.canSignWithoutServer
visible: _is2fa && !Daemon.currentWallet.canSignWithoutServer
text: 'tx_remaining' in Daemon.currentWallet.billingInfo
? Daemon.currentWallet.billingInfo['tx_remaining']
: qsTr('unknown')
@ -201,7 +204,7 @@ Pane {
Label {
Layout.columnSpan: 2
visible: !Daemon.currentWallet.canSignWithoutServer
visible: _is2fa && !Daemon.currentWallet.canSignWithoutServer
text: qsTr('Billing')
color: Material.accentColor
}
@ -209,6 +212,7 @@ Pane {
TextHighlightPane {
Layout.columnSpan: 2
Layout.fillWidth: true
visible: _is2fa && !Daemon.currentWallet.canSignWithoutServer
ColumnLayout {
spacing: 0
@ -242,14 +246,6 @@ Pane {
}
}
}
GridLayout {
id: detailsLayout
visible: Daemon.currentWallet
Layout.preferredWidth: parent.width
columns: 2
Label {
text: qsTr('Derivation prefix')
visible: Daemon.currentWallet.derivationPrefix

3
electrum/gui/qml/qewallet.py

@ -607,8 +607,6 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
try:
default_expiry = self.wallet.config.get('request_expiry', PR_DEFAULT_EXPIRATION_WHEN_CREATING)
if self.wallet.lnworker and self.wallet.lnworker.channels:
addr = None
if self.wallet.config.get('bolt11_fallback', True):
addr = self.wallet.get_unused_address()
# if addr is None, we ran out of addresses
if addr is None:
@ -619,7 +617,6 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
key, addr = self.create_bitcoin_request(None, None, default_expiry, ignore_gap)
if not key:
return
# self.addressModel.init_model()
except InvoiceError as e:
self.requestCreateError.emit('fatal',_('Error creating payment request') + ':\n' + str(e))
return

3
electrum/invoices.py

@ -122,8 +122,7 @@ class Invoice(StoredObject):
address = None
if self.outputs:
address = self.outputs[0].address if len(self.outputs) > 0 else None
if not address:
if self.is_lightning():
if not address and self.is_lightning():
address = self._lnaddr.get_fallback_address() or None
return address

Loading…
Cancel
Save