electrum

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

commit 1946254ef2627303396b61a413383d5ce5362cc3
parent bf25d765d93da2176b85aa293326586b166b7f6e
Author: SomberNight <somber.night@protonmail.com>
Date:   Tue,  9 Oct 2018 16:34:49 +0200

on_update_fail_htlc: don't send commitment without changes

c-lightning was force-closing channels with us: "[lnbase:127.0.0.1] error commit_sig with no changes"

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

diff --git a/electrum/lnbase.py b/electrum/lnbase.py @@ -985,24 +985,22 @@ class Peer(PrintError): code = failure_msg.code code_name = ONION_FAILURE_CODE_MAP.get(code, 'unknown_error!!') data = failure_msg.data - print("UPDATE_FAIL_HTLC", code_name, code, data) + self.print_error("UPDATE_FAIL_HTLC", code_name, code, data) try: short_chan_id = route[sender_idx + 1].short_channel_id except IndexError: - print("payment destination reported error") + self.print_error("payment destination reported error") else: # TODO this should depend on the error # also, we need finer blacklisting (directed edges; nodes) self.network.path_finder.blacklist.add(short_chan_id) - print("HTLC failure with code {} ({})".format(code, code_name)) + self.print_error("HTLC failure with code {} ({})".format(code, code_name)) chan = self.channels[channel_id] - self.send_commitment(chan) - await self.receive_revoke(chan) chan.receive_fail_htlc(htlc_id) await self.receive_commitment(chan) self.revoke(chan) - self.send_commitment(chan) # htlc will be removed + self.send_commitment(chan) # htlc will be removed await self.receive_revoke(chan) self.lnworker.save_channel(chan)