mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
add new peer_state for the case where we are waiting for the remote party to force close a channel
This commit is contained in:
parent
8688a6530a
commit
9ccfa318f8
2 changed files with 4 additions and 1 deletions
|
@ -72,6 +72,7 @@ class peer_states(IntEnum):
|
||||||
DISCONNECTED = 0
|
DISCONNECTED = 0
|
||||||
REESTABLISHING = 1
|
REESTABLISHING = 1
|
||||||
GOOD = 2
|
GOOD = 2
|
||||||
|
BAD = 3
|
||||||
|
|
||||||
cs = channel_states
|
cs = channel_states
|
||||||
state_transitions = [
|
state_transitions = [
|
||||||
|
|
|
@ -848,10 +848,12 @@ class Peer(Logger):
|
||||||
else:
|
else:
|
||||||
if dlp_enabled and should_close_they_are_ahead:
|
if dlp_enabled and should_close_they_are_ahead:
|
||||||
self.logger.warning(f"channel_reestablish: remote is ahead of us! luckily DLP is enabled. remote PCP: {bh2u(their_local_pcp)}")
|
self.logger.warning(f"channel_reestablish: remote is ahead of us! luckily DLP is enabled. remote PCP: {bh2u(their_local_pcp)}")
|
||||||
|
# data_loss_protect_remote_pcp is used in lnsweep
|
||||||
chan.set_data_loss_protect_remote_pcp(their_next_local_ctn - 1, their_local_pcp)
|
chan.set_data_loss_protect_remote_pcp(their_next_local_ctn - 1, their_local_pcp)
|
||||||
self.lnworker.save_channel(chan)
|
self.lnworker.save_channel(chan)
|
||||||
if should_close_they_are_ahead:
|
if should_close_they_are_ahead:
|
||||||
self.logger.warning(f"channel_reestablish: remote is ahead of us! trying to get them to force-close.")
|
self.logger.warning(f"channel_reestablish: remote is ahead of us! They should force-close.")
|
||||||
|
chan.peer_state = peer_states.BAD
|
||||||
return
|
return
|
||||||
elif should_close_we_are_ahead:
|
elif should_close_we_are_ahead:
|
||||||
self.logger.warning(f"channel_reestablish: we are ahead of remote! trying to force-close.")
|
self.logger.warning(f"channel_reestablish: we are ahead of remote! trying to force-close.")
|
||||||
|
|
Loading…
Add table
Reference in a new issue