Browse Source

lnbase: resend revoke_and_ack if necessary

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
Janus 6 years ago
committed by ThomasV
parent
commit
520b5703a4
  1. 14
      electrum/lnbase.py

14
electrum/lnbase.py

@ -816,6 +816,20 @@ class Peer(PrintError):
# compare local ctns
local_ctn = int.from_bytes(channel_reestablish_msg["next_remote_revocation_number"], 'big')
if local_ctn != chan.config[LOCAL].ctn:
if remote_ctn == chan.config[LOCAL].ctn + 1:
# A node:
# if next_remote_revocation_number is equal to the
# commitment number of the last revoke_and_ack
# the receiving node sent, AND the receiving node
# hasn't already received a closing_signed:
# MUST re-send the revoke_and_ack.
self.config[LOCAL]=self.config[LOCAL]._replace(
ctn=remote_ctn,
)
self.revoke(chan)
self.channel_reestablished[chan_id].set_result(True)
return
else:
self.print_error("expected local ctn {}, got {}".format(chan.config[LOCAL].ctn, local_ctn))
# TODO iff their ctn is lower than ours, we should force close instead
try_to_get_remote_to_force_close_with_their_latest()

Loading…
Cancel
Save