electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 520b5703a4918ac46b88e753b3012b19cf8f8a5e
parent 30753ed4756a49b45c201f714022e4765908b717
Author: Janus <ysangkok@gmail.com>
Date:   Fri, 12 Oct 2018 18:42:57 +0200

lnbase: resend revoke_and_ack if necessary

Diffstat:
Melectrum/lnbase.py | 22++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/electrum/lnbase.py b/electrum/lnbase.py @@ -816,10 +816,24 @@ 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: - 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() - return + 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() + return # compare per commitment points (needs data_protect option) their_pcp = channel_reestablish_msg.get("my_current_per_commitment_point", None) if their_pcp is not None: