lnpeer: rename trigger_force_close to request_force_close
for more consistent naming with rest of the code
This commit is contained in:
@@ -1049,7 +1049,8 @@ class Peer(Logger):
|
|||||||
chan.set_state(ChannelState.OPENING)
|
chan.set_state(ChannelState.OPENING)
|
||||||
self.lnworker.add_new_channel(chan)
|
self.lnworker.add_new_channel(chan)
|
||||||
|
|
||||||
async def trigger_force_close(self, channel_id: bytes):
|
async def request_force_close(self, channel_id: bytes):
|
||||||
|
"""Try to trigger the remote peer to force-close."""
|
||||||
await self.initialized
|
await self.initialized
|
||||||
# First, we intentionally send a "channel_reestablish" msg with an old state.
|
# First, we intentionally send a "channel_reestablish" msg with an old state.
|
||||||
# Many nodes (but not all) automatically force-close when seeing this.
|
# Many nodes (but not all) automatically force-close when seeing this.
|
||||||
@@ -1193,7 +1194,7 @@ class Peer(Logger):
|
|||||||
chan_id = chan.channel_id
|
chan_id = chan.channel_id
|
||||||
if chan.should_request_force_close:
|
if chan.should_request_force_close:
|
||||||
chan.set_state(ChannelState.REQUESTED_FCLOSE)
|
chan.set_state(ChannelState.REQUESTED_FCLOSE)
|
||||||
await self.trigger_force_close(chan_id)
|
await self.request_force_close(chan_id)
|
||||||
chan.should_request_force_close = False
|
chan.should_request_force_close = False
|
||||||
return
|
return
|
||||||
assert ChannelState.PREOPENING < chan.get_state() < ChannelState.FORCE_CLOSING
|
assert ChannelState.PREOPENING < chan.get_state() < ChannelState.FORCE_CLOSING
|
||||||
|
|||||||
@@ -2440,7 +2440,7 @@ class LNWallet(LNWorker):
|
|||||||
peer.close_and_cleanup()
|
peer.close_and_cleanup()
|
||||||
elif connect_str:
|
elif connect_str:
|
||||||
peer = await self.add_peer(connect_str)
|
peer = await self.add_peer(connect_str)
|
||||||
await peer.trigger_force_close(channel_id)
|
await peer.request_force_close(channel_id)
|
||||||
elif channel_id in self.channel_backups:
|
elif channel_id in self.channel_backups:
|
||||||
await self._request_force_close_from_backup(channel_id)
|
await self._request_force_close_from_backup(channel_id)
|
||||||
else:
|
else:
|
||||||
@@ -2516,7 +2516,7 @@ class LNWallet(LNWorker):
|
|||||||
try:
|
try:
|
||||||
async with OldTaskGroup(wait=any) as group:
|
async with OldTaskGroup(wait=any) as group:
|
||||||
await group.spawn(peer._message_loop())
|
await group.spawn(peer._message_loop())
|
||||||
await group.spawn(peer.trigger_force_close(channel_id))
|
await group.spawn(peer.request_force_close(channel_id))
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.info(f'failed to connect {host} {e}')
|
self.logger.info(f'failed to connect {host} {e}')
|
||||||
|
|||||||
Reference in New Issue
Block a user