tlnpeer: (trivial) log htlc in on_update_add_htlc - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit 0491da2c662fdf74c1470acdb2bb856640780245 (DIR) parent fd48b96335b6466ebaf270b2cc3c734e200e30d1 (HTM) Author: SomberNight <somber.night@protonmail.com> Date: Mon, 8 Mar 2021 18:51:52 +0100 lnpeer: (trivial) log htlc in on_update_add_htlc Diffstat: M electrum/lnpeer.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- (DIR) diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py t@@ -1315,22 +1315,22 @@ class Peer(Logger): def on_update_add_htlc(self, chan: Channel, payload): payment_hash = payload["payment_hash"] htlc_id = payload["id"] - self.logger.info(f"on_update_add_htlc. chan {chan.short_channel_id}. htlc_id {htlc_id}") cltv_expiry = payload["cltv_expiry"] amount_msat_htlc = payload["amount_msat"] onion_packet = payload["onion_routing_packet"] - if chan.get_state() != ChannelState.OPEN: - raise RemoteMisbehaving(f"received update_add_htlc while chan.get_state() != OPEN. state was {chan.get_state()!r}") - if cltv_expiry > bitcoin.NLOCKTIME_BLOCKHEIGHT_MAX: - asyncio.ensure_future(self.lnworker.try_force_closing(chan.channel_id)) - raise RemoteMisbehaving(f"received update_add_htlc with cltv_expiry > BLOCKHEIGHT_MAX. value was {cltv_expiry}") - # add htlc htlc = UpdateAddHtlc( amount_msat=amount_msat_htlc, payment_hash=payment_hash, cltv_expiry=cltv_expiry, timestamp=int(time.time()), htlc_id=htlc_id) + self.logger.info(f"on_update_add_htlc. chan {chan.short_channel_id}. htlc={str(htlc)}") + if chan.get_state() != ChannelState.OPEN: + raise RemoteMisbehaving(f"received update_add_htlc while chan.get_state() != OPEN. state was {chan.get_state()!r}") + if cltv_expiry > bitcoin.NLOCKTIME_BLOCKHEIGHT_MAX: + asyncio.ensure_future(self.lnworker.try_force_closing(chan.channel_id)) + raise RemoteMisbehaving(f"received update_add_htlc with cltv_expiry > BLOCKHEIGHT_MAX. value was {cltv_expiry}") + # add htlc chan.receive_htlc(htlc, onion_packet) util.trigger_callback('htlc_added', chan, htlc, RECEIVED) t@@ -1562,6 +1562,7 @@ class Peer(Logger): if not (invoice_msat is None or invoice_msat <= total_msat <= 2 * invoice_msat): log_fail_reason(f"total_msat={total_msat} too different from invoice_msat={invoice_msat}") raise exc_incorrect_or_unknown_pd + self.logger.info(f"maybe_fulfill_htlc. will FULFILL HTLC: chan {chan.short_channel_id}. htlc={str(htlc)}") return preimage, None def fulfill_htlc(self, chan: Channel, htlc_id: int, preimage: bytes):