remove lightning parameter from wallet.create_request
This commit is contained in:
@@ -957,7 +957,7 @@ class Commands:
|
||||
return False
|
||||
amount = satoshis(amount)
|
||||
expiration = int(expiration) if expiration else None
|
||||
key = wallet.create_request(amount, memo, expiration, addr, True)
|
||||
key = wallet.create_request(amount, memo, expiration, addr)
|
||||
req = wallet.get_request(key)
|
||||
return wallet.export_request(req)
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ class ReceiveScreen(CScreen):
|
||||
return
|
||||
self.address = addr
|
||||
try:
|
||||
key = self.app.wallet.create_request(amount_sat, message, expiry, self.address, lightning=self.app.wallet.has_lightning())
|
||||
key = self.app.wallet.create_request(amount_sat, message, expiry, self.address)
|
||||
except InvoiceError as e:
|
||||
self.app.show_error(_('Error creating payment request') + ':\n' + str(e))
|
||||
return
|
||||
|
||||
@@ -469,7 +469,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
||||
return
|
||||
addr = self.wallet.create_new_address(False)
|
||||
|
||||
req_key = self.wallet.create_request(amount, message, expiration, addr, False)
|
||||
req_key = self.wallet.create_request(amount, message, expiration, addr)
|
||||
#try:
|
||||
#self.wallet.add_payment_request(req)
|
||||
#except Exception as e:
|
||||
@@ -486,6 +486,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
||||
@pyqtSlot(QEAmount, str, int, bool)
|
||||
@pyqtSlot(QEAmount, str, int, bool, bool)
|
||||
def create_request(self, amount: QEAmount, message: str, expiration: int, is_lightning: bool = False, ignore_gap: bool = False):
|
||||
# TODO: unify this method and create_bitcoin_request
|
||||
try:
|
||||
if is_lightning:
|
||||
if not self.wallet.lnworker.channels:
|
||||
@@ -494,7 +495,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
||||
# TODO maybe show a warning if amount exceeds lnworker.num_sats_can_receive (as in kivy)
|
||||
# TODO fallback address robustness
|
||||
addr = self.wallet.get_unused_address()
|
||||
key = self.wallet.create_request(amount.satsInt, message, expiration, addr, True)
|
||||
key = self.wallet.create_request(amount.satsInt, message, expiration, addr)
|
||||
else:
|
||||
key, addr = self.create_bitcoin_request(amount.satsInt, message, expiration, ignore_gap)
|
||||
if not key:
|
||||
|
||||
@@ -325,9 +325,8 @@ class ReceiveTab(QWidget, MessageBoxMixin, Logger):
|
||||
self.window.address_list.update()
|
||||
|
||||
# generate even if we cannot receive
|
||||
lightning = self.wallet.has_lightning()
|
||||
try:
|
||||
key = self.wallet.create_request(amount_sat, message, expiry, address, lightning=lightning)
|
||||
key = self.wallet.create_request(amount_sat, message, expiry, address)
|
||||
except InvoiceError as e:
|
||||
self.show_error(_('Error creating payment request') + ':\n' + str(e))
|
||||
return
|
||||
|
||||
@@ -2424,12 +2424,13 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
||||
status = self.get_request_status(addr)
|
||||
util.trigger_callback('request_status', self, addr, status)
|
||||
|
||||
def create_request(self, amount_sat: int, message: str, exp_delay: int, address: str, lightning: bool):
|
||||
def create_request(self, amount_sat: int, message: str, exp_delay: int, address: str):
|
||||
# for receiving
|
||||
amount_sat = amount_sat or 0
|
||||
exp_delay = exp_delay or 0
|
||||
timestamp = int(time.time())
|
||||
fallback_address = address if self.config.get('bolt11_fallback', True) else None
|
||||
lightning = self.has_lightning()
|
||||
if lightning:
|
||||
lightning_invoice = self.lnworker.add_request(
|
||||
amount_sat=amount_sat,
|
||||
|
||||
Reference in New Issue
Block a user