Browse Source

cli: require password for close_channel, request_force_close, export_channel_backup, reverse_swap, rebalance_channels

master
Sander van Grieken 1 year ago
parent
commit
c191fbec29
No known key found for this signature in database
GPG Key ID: 9BCF8209EA402EBA
  1. 20
      electrum/commands.py

20
electrum/commands.py

@ -1227,15 +1227,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.
@ -1245,8 +1245,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)
@ -1273,8 +1273,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.
@ -1326,8 +1326,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

Loading…
Cancel
Save