close: param to force-close a leased channel

By default, we won't close a channel that we leased to a peer.
You can override this with the `force_lease_closed` flag.

Changelog-Added: JSON-RPC: close now has parameter to force close a leased channel (option_will_fund)
This commit is contained in:
niftynei
2021-07-02 15:38:59 -05:00
committed by neil saitug
parent 19d4f18241
commit f3b54a510b
5 changed files with 36 additions and 6 deletions

View File

@@ -515,17 +515,23 @@ class LightningRpc(UnixDomainSocketRpc):
payload.update({k: v for k, v in kwargs.items()})
return self.call("check", payload)
def close(self, peer_id, unilateraltimeout=None, destination=None, fee_negotiation_step=None):
def close(self, peer_id, unilateraltimeout=None, destination=None, fee_negotiation_step=None, force_lease_closed=False):
"""
Close the channel with peer {id}, forcing a unilateral
close after {unilateraltimeout} seconds if non-zero, and
the to-local output will be sent to {destination}.
If channel funds have been leased to the peer and the
lease has not yet expired, you can force a close with
{force_lease_closed}. Note that your funds will still be
locked until the lease expires.
"""
payload = {
"id": peer_id,
"unilateraltimeout": unilateraltimeout,
"destination": destination,
"fee_negotiation_step": fee_negotiation_step
"fee_negotiation_step": fee_negotiation_step,
"force_lease_closed": force_lease_closed,
}
return self.call("close", payload)