qml: send screen: bip21: fallback to onchain addr if no LN channels
given a bip21 uri that has both onchain addr and bolt11, if we have LN enabled but no LN channels, auto-fallback to paying onchain we will have to clean up and unify this logic between GUIs. becoming spaghetti :/ rumour has it, Thomas has a branch? :P
This commit is contained in:
@@ -232,6 +232,9 @@ Item {
|
|||||||
onValidationWarning: {
|
onValidationWarning: {
|
||||||
if (code == 'no_channels') {
|
if (code == 'no_channels') {
|
||||||
var dialog = app.messageDialog.createObject(app, { text: message })
|
var dialog = app.messageDialog.createObject(app, { text: message })
|
||||||
|
dialog.closed.connect(function() {
|
||||||
|
restartSendDialog()
|
||||||
|
})
|
||||||
dialog.open()
|
dialog.open()
|
||||||
// TODO: ask user to open a channel, if funds allow
|
// TODO: ask user to open a channel, if funds allow
|
||||||
// and maybe store invoice if expiry allows
|
// and maybe store invoice if expiry allows
|
||||||
|
|||||||
@@ -554,10 +554,14 @@ class QEInvoiceParser(QEInvoice):
|
|||||||
self._logger.debug('flow with LN but not LN enabled AND having bip21 uri')
|
self._logger.debug('flow with LN but not LN enabled AND having bip21 uri')
|
||||||
self._validateRecipient_bip21_onchain(bip21)
|
self._validateRecipient_bip21_onchain(bip21)
|
||||||
else:
|
else:
|
||||||
self.setValidLightningInvoice(lninvoice)
|
|
||||||
if not self._wallet.wallet.lnworker.channels:
|
if not self._wallet.wallet.lnworker.channels:
|
||||||
self.validationWarning.emit('no_channels',_('Detected valid Lightning invoice, but there are no open channels'))
|
if bip21 and 'address' in bip21:
|
||||||
|
self._logger.debug('flow where invoice has both LN and onchain, we have LN enabled but no channels')
|
||||||
|
self._validateRecipient_bip21_onchain(bip21)
|
||||||
|
else:
|
||||||
|
self.validationWarning.emit('no_channels',_('Detected valid Lightning invoice, but there are no open channels'))
|
||||||
else:
|
else:
|
||||||
|
self.setValidLightningInvoice(lninvoice)
|
||||||
self.validationSuccess.emit()
|
self.validationSuccess.emit()
|
||||||
else:
|
else:
|
||||||
self._logger.debug('flow without LN but having bip21 uri')
|
self._logger.debug('flow without LN but having bip21 uri')
|
||||||
|
|||||||
Reference in New Issue
Block a user