Merge pull request #9238 from accumulator/issue9236
commands: require wallet password for lnpay command closes https://github.com/spesmilo/electrum/issues/9236
This commit is contained in:
@@ -1176,8 +1176,8 @@ class Commands:
|
||||
invoice = Invoice.from_bech32(invoice)
|
||||
return invoice.to_debug_json()
|
||||
|
||||
@command('wnl')
|
||||
async def lnpay(self, invoice, timeout=120, wallet: Abstract_Wallet = None):
|
||||
@command('wnpl')
|
||||
async def lnpay(self, invoice, timeout=120, password=None, wallet: Abstract_Wallet = None):
|
||||
lnworker = wallet.lnworker
|
||||
lnaddr = lnworker._check_invoice(invoice)
|
||||
payment_hash = lnaddr.paymenthash
|
||||
@@ -1244,15 +1244,15 @@ class Commands:
|
||||
self.network.path_finder.liquidity_hints.reset_liquidity_hints()
|
||||
self.network.path_finder.clear_blacklist()
|
||||
|
||||
@command('wnl')
|
||||
async def close_channel(self, channel_point, force=False, wallet: Abstract_Wallet = None):
|
||||
@command('wnpl')
|
||||
async def close_channel(self, channel_point, force=False, password=None, wallet: Abstract_Wallet = None):
|
||||
txid, index = channel_point.split(':')
|
||||
chan_id, _ = channel_id_from_funding_tx(txid, int(index))
|
||||
coro = wallet.lnworker.force_close_channel(chan_id) if force else wallet.lnworker.close_channel(chan_id)
|
||||
return await coro
|
||||
|
||||
@command('wnl')
|
||||
async def request_force_close(self, channel_point, connection_string=None, wallet: Abstract_Wallet = None):
|
||||
@command('wnpl')
|
||||
async def request_force_close(self, channel_point, connection_string=None, password=None, wallet: Abstract_Wallet = None):
|
||||
"""
|
||||
Requests the remote to force close a channel.
|
||||
If a connection string is passed, can be used without having state or any backup for the channel.
|
||||
@@ -1262,8 +1262,8 @@ class Commands:
|
||||
chan_id, _ = channel_id_from_funding_tx(txid, int(index))
|
||||
await wallet.lnworker.request_force_close(chan_id, connect_str=connection_string)
|
||||
|
||||
@command('wl')
|
||||
async def export_channel_backup(self, channel_point, wallet: Abstract_Wallet = None):
|
||||
@command('wpl')
|
||||
async def export_channel_backup(self, channel_point, password=None, wallet: Abstract_Wallet = None):
|
||||
txid, index = channel_point.split(':')
|
||||
chan_id, _ = channel_id_from_funding_tx(txid, int(index))
|
||||
return wallet.lnworker.export_channel_backup(chan_id)
|
||||
@@ -1272,8 +1272,8 @@ class Commands:
|
||||
async def import_channel_backup(self, encrypted, wallet: Abstract_Wallet = None):
|
||||
return wallet.lnworker.import_channel_backup(encrypted)
|
||||
|
||||
@command('wnl')
|
||||
async def get_channel_ctx(self, channel_point, iknowwhatimdoing=False, wallet: Abstract_Wallet = None):
|
||||
@command('wnpl')
|
||||
async def get_channel_ctx(self, channel_point, password=None, iknowwhatimdoing=False, wallet: Abstract_Wallet = None):
|
||||
""" return the current commitment transaction of a channel """
|
||||
if not iknowwhatimdoing:
|
||||
raise UserFacingException(
|
||||
@@ -1290,8 +1290,8 @@ class Commands:
|
||||
""" return the local watchtower's ctn of channel. used in regtests """
|
||||
return await self.network.local_watchtower.sweepstore.get_ctn(channel_point, None)
|
||||
|
||||
@command('wnl')
|
||||
async def rebalance_channels(self, from_scid, dest_scid, amount, wallet: Abstract_Wallet = None):
|
||||
@command('wnpl')
|
||||
async def rebalance_channels(self, from_scid, dest_scid, amount, password=None, wallet: Abstract_Wallet = None):
|
||||
"""
|
||||
Rebalance channels.
|
||||
If trampoline is used, channels must be with different trampolines.
|
||||
@@ -1343,8 +1343,8 @@ class Commands:
|
||||
'onchain_amount': format_satoshis(onchain_amount_sat),
|
||||
}
|
||||
|
||||
@command('wnl')
|
||||
async def reverse_swap(self, lightning_amount, onchain_amount, wallet: Abstract_Wallet = None):
|
||||
@command('wnpl')
|
||||
async def reverse_swap(self, lightning_amount, onchain_amount, password=None, wallet: Abstract_Wallet = None):
|
||||
"""Reverse submarine swap: send on Lightning, receive on-chain
|
||||
"""
|
||||
sm = wallet.lnworker.swap_manager
|
||||
|
||||
Reference in New Issue
Block a user