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)
|
invoice = Invoice.from_bech32(invoice)
|
||||||
return invoice.to_debug_json()
|
return invoice.to_debug_json()
|
||||||
|
|
||||||
@command('wnl')
|
@command('wnpl')
|
||||||
async def lnpay(self, invoice, timeout=120, wallet: Abstract_Wallet = None):
|
async def lnpay(self, invoice, timeout=120, password=None, wallet: Abstract_Wallet = None):
|
||||||
lnworker = wallet.lnworker
|
lnworker = wallet.lnworker
|
||||||
lnaddr = lnworker._check_invoice(invoice)
|
lnaddr = lnworker._check_invoice(invoice)
|
||||||
payment_hash = lnaddr.paymenthash
|
payment_hash = lnaddr.paymenthash
|
||||||
@@ -1244,15 +1244,15 @@ class Commands:
|
|||||||
self.network.path_finder.liquidity_hints.reset_liquidity_hints()
|
self.network.path_finder.liquidity_hints.reset_liquidity_hints()
|
||||||
self.network.path_finder.clear_blacklist()
|
self.network.path_finder.clear_blacklist()
|
||||||
|
|
||||||
@command('wnl')
|
@command('wnpl')
|
||||||
async def close_channel(self, channel_point, force=False, wallet: Abstract_Wallet = None):
|
async def close_channel(self, channel_point, force=False, password=None, wallet: Abstract_Wallet = None):
|
||||||
txid, index = channel_point.split(':')
|
txid, index = channel_point.split(':')
|
||||||
chan_id, _ = channel_id_from_funding_tx(txid, int(index))
|
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)
|
coro = wallet.lnworker.force_close_channel(chan_id) if force else wallet.lnworker.close_channel(chan_id)
|
||||||
return await coro
|
return await coro
|
||||||
|
|
||||||
@command('wnl')
|
@command('wnpl')
|
||||||
async def request_force_close(self, channel_point, connection_string=None, wallet: Abstract_Wallet = None):
|
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.
|
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.
|
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))
|
chan_id, _ = channel_id_from_funding_tx(txid, int(index))
|
||||||
await wallet.lnworker.request_force_close(chan_id, connect_str=connection_string)
|
await wallet.lnworker.request_force_close(chan_id, connect_str=connection_string)
|
||||||
|
|
||||||
@command('wl')
|
@command('wpl')
|
||||||
async def export_channel_backup(self, channel_point, wallet: Abstract_Wallet = None):
|
async def export_channel_backup(self, channel_point, password=None, wallet: Abstract_Wallet = None):
|
||||||
txid, index = channel_point.split(':')
|
txid, index = channel_point.split(':')
|
||||||
chan_id, _ = channel_id_from_funding_tx(txid, int(index))
|
chan_id, _ = channel_id_from_funding_tx(txid, int(index))
|
||||||
return wallet.lnworker.export_channel_backup(chan_id)
|
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):
|
async def import_channel_backup(self, encrypted, wallet: Abstract_Wallet = None):
|
||||||
return wallet.lnworker.import_channel_backup(encrypted)
|
return wallet.lnworker.import_channel_backup(encrypted)
|
||||||
|
|
||||||
@command('wnl')
|
@command('wnpl')
|
||||||
async def get_channel_ctx(self, channel_point, iknowwhatimdoing=False, wallet: Abstract_Wallet = None):
|
async def get_channel_ctx(self, channel_point, password=None, iknowwhatimdoing=False, wallet: Abstract_Wallet = None):
|
||||||
""" return the current commitment transaction of a channel """
|
""" return the current commitment transaction of a channel """
|
||||||
if not iknowwhatimdoing:
|
if not iknowwhatimdoing:
|
||||||
raise UserFacingException(
|
raise UserFacingException(
|
||||||
@@ -1290,8 +1290,8 @@ class Commands:
|
|||||||
""" return the local watchtower's ctn of channel. used in regtests """
|
""" return the local watchtower's ctn of channel. used in regtests """
|
||||||
return await self.network.local_watchtower.sweepstore.get_ctn(channel_point, None)
|
return await self.network.local_watchtower.sweepstore.get_ctn(channel_point, None)
|
||||||
|
|
||||||
@command('wnl')
|
@command('wnpl')
|
||||||
async def rebalance_channels(self, from_scid, dest_scid, amount, wallet: Abstract_Wallet = None):
|
async def rebalance_channels(self, from_scid, dest_scid, amount, password=None, wallet: Abstract_Wallet = None):
|
||||||
"""
|
"""
|
||||||
Rebalance channels.
|
Rebalance channels.
|
||||||
If trampoline is used, channels must be with different trampolines.
|
If trampoline is used, channels must be with different trampolines.
|
||||||
@@ -1343,8 +1343,8 @@ class Commands:
|
|||||||
'onchain_amount': format_satoshis(onchain_amount_sat),
|
'onchain_amount': format_satoshis(onchain_amount_sat),
|
||||||
}
|
}
|
||||||
|
|
||||||
@command('wnl')
|
@command('wnpl')
|
||||||
async def reverse_swap(self, lightning_amount, onchain_amount, wallet: Abstract_Wallet = None):
|
async def reverse_swap(self, lightning_amount, onchain_amount, password=None, wallet: Abstract_Wallet = None):
|
||||||
"""Reverse submarine swap: send on Lightning, receive on-chain
|
"""Reverse submarine swap: send on Lightning, receive on-chain
|
||||||
"""
|
"""
|
||||||
sm = wallet.lnworker.swap_manager
|
sm = wallet.lnworker.swap_manager
|
||||||
|
|||||||
Reference in New Issue
Block a user