1
0

lnpeer: rename trigger_force_close to request_force_close

for more consistent naming with rest of the code
This commit is contained in:
SomberNight
2022-06-10 17:13:11 +02:00
parent f12e87be93
commit 1613736b45
2 changed files with 5 additions and 4 deletions

View File

@@ -1049,7 +1049,8 @@ class Peer(Logger):
chan.set_state(ChannelState.OPENING)
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
# First, we intentionally send a "channel_reestablish" msg with an old state.
# Many nodes (but not all) automatically force-close when seeing this.
@@ -1193,7 +1194,7 @@ class Peer(Logger):
chan_id = chan.channel_id
if chan.should_request_force_close:
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
return
assert ChannelState.PREOPENING < chan.get_state() < ChannelState.FORCE_CLOSING

View File

@@ -2440,7 +2440,7 @@ class LNWallet(LNWorker):
peer.close_and_cleanup()
elif 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:
await self._request_force_close_from_backup(channel_id)
else:
@@ -2516,7 +2516,7 @@ class LNWallet(LNWorker):
try:
async with OldTaskGroup(wait=any) as group:
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
except Exception as e:
self.logger.info(f'failed to connect {host} {e}')